前言
最近看到有一篇有關EnterKeyHint文章,整個手癢跑去玩玩看,官方說明這方式是針對虛擬鍵盤才會出現的效果,如下面表格:
Keyword | Description |
---|---|
enter |
The user agent should present a cue for the operation ‘enter’, typically inserting a new line. |
done |
The user agent should present a cue for the operation ‘done’, typically meaning there is nothing more to input and the input method editor (IME) will be closed. |
go |
The user agent should present a cue for the operation ‘go’, typically meaning to take the user to the target of the text they typed. |
next |
The user agent should present a cue for the operation ‘next’, typically taking the user to the next field that will accept text. |
previous |
The user agent should present a cue for the operation ‘previous’, typically taking the user to the previous field that will accept text. |
search |
The user agent should present a cue for the operation ‘search’, typically taking the user to the results of searching for the text they have typed. |
send |
The user agent should present a cue for the operation ‘send’, typically delivering the text to its target. |
這功能只有手機版本的虛擬鍵盤才看得見,若你要用windows的虛擬鍵盤是看不見的歐!!ヽ(*。>Д<)o゜
創建Html
我們創建簡單易點的html,不需要殘虐自己一定要把版面排很齊。參考以下範例:
1 |
|
這幾些都是要focus在輸入框裡面就可以看得見,如下圖,這樣就會提升UI操作順暢。
依據自己評估,決定在使用。
[{"url":"/img/html-enterkeyHint/01.png","alt":""},{"url":"/img/html-enterkeyHint/02.png","alt":""},{"url":"/img/html-enterkeyHint/03.png","alt":""},{"url":"/img/html-enterkeyHint/04.png","alt":""},{"url":"/img/html-enterkeyHint/05.png","alt":""},{"url":"/img/html-enterkeyHint/06.png","alt":""},{"url":"/img/html-enterkeyHint/07.png","alt":""}]
題外話
Stefan Judis 曾經在2020年有提到 Enterkeyhint ,有支援 Safari 瀏覽器(IOS),有興趣的人可以實驗看看。FireFox事實上是有出現,只是不像是Chrome一樣馬上出現,必須要按下去(Enter)才會出現,使用上需要自己拿捏使用方式,以免被客戶要求強迫修改。
Safari now supports `enterkeyhint`. 👏
— Stefan @ goto CPH 🇩🇰 (@stefanjudis) April 14, 2020
I always like it when the enter key gives me more context. 👇
🔗 Spec: https://t.co/IOQkUsjB6f#devsheets pic.twitter.com/7HHX77Jow7
文件參考
MDN - EnterKeyHint
CSS-TRICKS - enterkeyhint
本部落格所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。轉載請註明來自 John Conte!
評論
DisqusGitalk