Skip to content

Commit a5422d9

Browse files
dtapuskadomenic
authored andcommitted
Add the enterkeyhint="" attribute
This allows an author to configure what type of icon is displayed in place of the enter key on virtual keyboards. Tests: web-platform-tests/wpt#12972
1 parent e000f5e commit a5422d9

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

source

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11364,6 +11364,7 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%
1136411364
<li><code data-x="attr-contenteditable">contenteditable</code></li>
1136511365
<li><code data-x="attr-dir">dir</code></li>
1136611366
<li><code data-x="attr-draggable">draggable</code></li>
11367+
<li><code data-x="attr-enterkeyhint">enterkeyhint</code></li>
1136711368
<li><code data-x="attr-hidden">hidden</code></li>
1136811369
<li><code data-x="attr-inputmode">inputmode</code></li>
1136911370
<li><code data-x="attr-is">is</code></li>
@@ -73699,6 +73700,7 @@ addShortcutKeyLabel(document.getElementById('c'));</code></pre>
7369973700

7370073701
<pre><code class="idl" data-x="">interface mixin <dfn>ElementContentEditable</dfn> {
7370173702
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-contentEditable">contentEditable</span>;
73703+
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-enterKeyHint">enterKeyHint</span>;
7370273704
readonly attribute boolean <span data-x="dom-isContentEditable">isContentEditable</span>;
7370373705
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-inputMode">inputMode</span>;
7370473706
};</code></pre>
@@ -74377,6 +74379,70 @@ body { display:none }
7437774379

7437874380
</div>
7437974381

74382+
<h4>Input modalities: the <code data-x="attr-enterkeyhint">enterkeyhint</code>
74383+
attribute</h4>
74384+
74385+
<p>User agents can support the <code data-x="attr-enterkeyhint">enterkeyhint</code>
74386+
attribute on form controls (such as the value of <code>textarea</code> elements), or in elements
74387+
in an <span>editing host</span> (e.g., using <code
74388+
data-x="attr-contenteditable">contenteditable</code>).</p>
74389+
74390+
<p>The <dfn><code data-x="attr-enterkeyhint">enterkeyhint</code></dfn> content attribute is an
74391+
<span>enumerated attribute</span> that specifies what action label (or icon) to present for the
74392+
enter key on virtual keyboards. This allows authors to customize the presentation of the enter key
74393+
in order to make it more helpful for users.</p>
74394+
74395+
<table>
74396+
<thead>
74397+
<tr>
74398+
<th> Keyword
74399+
<th> Description
74400+
<tbody>
74401+
<tr>
74402+
<td><dfn><code data-x="attr-enterkeyhint-keyword-enter">enter</code></dfn>
74403+
<td>The user agent should present a cue for the operation 'enter', typically
74404+
inserting a new line.
74405+
<tr>
74406+
<td><dfn><code data-x="attr-enterkeyhint-keyword-done">done</code></dfn>
74407+
<td>The user agent should present a cue for the operation 'done', typically
74408+
meaning there is nothing more to input and the IME will be closed.
74409+
<tr>
74410+
<td><dfn><code data-x="attr-enterkeyhint-keyword-go">go</code></dfn>
74411+
<td> The user agent should present a cue for the operation 'go', typically
74412+
meaning to take the user to the target of the text they typed.
74413+
<tr>
74414+
<td><dfn><code data-x="attr-enterkeyhint-keyword-next">next</code></dfn>
74415+
<td>The user agent should present a cue for the operation 'next', typically
74416+
taking the user to the next field that will accept text.
74417+
<tr>
74418+
<td><dfn><code data-x="attr-enterkeyhint-keyword-previous">previous</code></dfn>
74419+
<td>The user agent should present a cue for the operation 'previous', typically
74420+
taking the user to the previous field that will accept text.
74421+
<tr>
74422+
<td><dfn><code data-x="attr-enterkeyhint-keyword-search">search</code></dfn>
74423+
<td>The user agent should present a cue for the operation 'search', typically
74424+
taking the user to the results of searching for the text they have typed.
74425+
<tr>
74426+
<td><dfn><code data-x="attr-enterkeyhint-keyword-send">send</code></dfn>
74427+
<td> The user agent should present a cue for the operation 'send', typically
74428+
delivering the text to its target.
74429+
</table>
74430+
74431+
<div w-nodev>
74432+
74433+
<p>The <dfn><code data-x="dom-enterKeyHint">enterKeyHint</code></dfn> IDL attribute must
74434+
<span>reflect</span> the <code data-x="attr-enterkeyhint">enterkeyhint</code> content
74435+
attribute, <span>limited to only known values</span>.</p>
74436+
74437+
<p>When <code data-x="attr-enterkeyhint">enterkeyhint</code> is unspecified (or is in a state not
74438+
supported by the user agent), the user agent should determine the default action label (or icon)
74439+
to present. Contextual information such as the <code data-x="attr-inputmode">inputmode</code>,
74440+
<code data-x="attr-input-type">type</code>, or <code data-x="attr-input-pattern">pattern</code>
74441+
attributes should be used to determine which action label (or icon) to present on the virtual
74442+
keyboard.</p>
74443+
74444+
</div>
74445+
7438074446
<h3 split-filename="dnd" id="dnd"><dfn>Drag and drop</dfn></h3>
7438174447

7438274448
<!-- v2: ideas for drag and drop:
@@ -118274,6 +118340,17 @@ interface <dfn>External</dfn> {
118274118340
<td> <code data-x="attr-fs-enctype">form</code>
118275118341
<td> Entry list encoding type to use for <span>form submission</span>
118276118342
<td> "<code data-x="attr-fs-enctype-urlencoded">application/x-www-form-urlencoded</code>"; "<code data-x="attr-fs-enctype-formdata">multipart/form-data</code>"; "<code data-x="attr-fs-enctype-text">text/plain</code>"
118343+
<tr>
118344+
<th> <code data-x="">enterkeyhint</code>
118345+
<td> <span data-x="attr-enterkeyhint">HTML elements</span>
118346+
<td> Hint for selecting an enter key action
118347+
<td> "<code data-x="attr-enterkeyhint-keyword-enter">enter</code>";
118348+
"<code data-x="attr-enterkeyhint-keyword-done">done</code>";
118349+
"<code data-x="attr-enterkeyhint-keyword-go">go</code>";
118350+
"<code data-x="attr-enterkeyhint-keyword-next">next</code>";
118351+
"<code data-x="attr-enterkeyhint-keyword-previous">previous</code>";
118352+
"<code data-x="attr-enterkeyhint-keyword-search">search</code>"
118353+
"<code data-x="attr-enterkeyhint-keyword-send">send</code>"
118277118354
<tr>
118278118355
<th> <code data-x="">for</code>
118279118356
<td> <code data-x="attr-label-for">label</code>

0 commit comments

Comments
 (0)