Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'enterkeyhint' attribute (was 'inputmodeaction') #3538

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

dtapuska
Copy link
Contributor

@dtapuska dtapuska commented Mar 6, 2018

inputmodeaction enterkeyhint allows an author to configure what type of iconify is
displayed in place for the enter key on virtual keyboards.

Tests: Soon


/dom.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/interaction.html ( diff )

@dtapuska
Copy link
Contributor Author

dtapuska commented Mar 6, 2018

@domenic thoughts?

@domenic
Copy link
Member

domenic commented Mar 7, 2018

I assume "iconify" is "icon"?

Exposing this capability to web apps makes a lot of sense to me. I haven't looked too much at the details yet besides seeing that there's a table of common actions and that this is a hint. It seems like a nice enhancement with no compat concerns in browsers that don't support it, which is nice.

@othermaciej, any thoughts as to whether this would be something interesting for mobile Safari?

@travisleithead, any thoughts as to whether this would be something interesting for Windows 10's touch keyboard for Edge? Maybe there's already a UWP API for this and you've just been itching to expose it to PWAs?

@bzbarsky, any thoughts for Mozilla on the platforms it runs on?

I'll try to dive in to the actual spec PR after giving this a few days to gather implementer interest.

@domenic domenic added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Mar 7, 2018
@othermaciej
Copy link
Collaborator

Is there a high-level explanation of this pproposal or do I need to just read the diff text?

@dtapuska
Copy link
Contributor Author

dtapuska commented Mar 7, 2018

You'll need to read the spec test. But basically this is moz-actionhint in a spec... See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-mozactionhint (with the enter keyword added)

@bzbarsky
Copy link
Contributor

bzbarsky commented Mar 7, 2018

The current implementation of this stuff in Gecko is basically Android-only. We pass the string around on all platforms, but Android is the only one that does anything with it.

The people who implemented this initially are no longer active, and this is the first time I've heard of this attribute myself, so I can't say much more than what I see through code archeology.... It was added in https://bugzilla.mozilla.org/show_bug.cgi?id=589879 largely because Firefox on Android at the time was using web tech for its own UI (mostly; like Firefox desktop does now) and this was needed for the URL bar UI. There was some spirited debate about this implementation and the fact that it was web-exposed (see https://bugzilla.mozilla.org/show_bug.cgi?id=614488 for example).

At this point there is one internal consumer (the "search texbox" widget)... which seems to not be used in the Android UI anywhere. So I think at this point mozactionhint is basically dead code we could remove with no observable effects.

What this means in terms of exposing it to the web, I'm not sure. ;)

If there's a more specific question, I can try to find people who might be able to answer it.

@domenic
Copy link
Member

domenic commented Mar 7, 2018

I think the more specific question is, would Mozilla be interested in exposing a standardized version of the attribute? Instead of deleting their nonstandard one :)

@bzbarsky
Copy link
Contributor

bzbarsky commented Mar 7, 2018

That sounds like a question for https://github.com/mozilla/standards-positions.

@annevk
Copy link
Member

annevk commented Mar 7, 2018

Filed mozilla/standards-positions#68.

@rniwa
Copy link
Collaborator

rniwa commented Mar 8, 2018

The idea of making enter key customizable and the list of options in the proposal seems good. iOS allows native apps to do almost exactly this for clarify in UI.

Nonetheless, I don't think it makes much sense to call this content attribute inputmodeaction since this doesn't affect what kind of things can be input, or the mode of input. It's really describing what happens when an user presses enter after the user had finished input text.

Maybe returnkeyaction or enterkeyaction would work better?

@othermaciej
Copy link
Collaborator

Perhaps just returnraction or even action?

@annevk
Copy link
Member

annevk commented Mar 8, 2018

I think the nice thing about the name is that inputmode describes the type of virtual keyboard, and inputmodeaction describes the look of the action key on that virtual keyboard. Makes it easier to tell that they are related.

@dtapuska
Copy link
Contributor Author

dtapuska commented Mar 8, 2018

FWIW I've been writing the chromium code for this today and I have been calling it inputaction for the structs (because InputModeAction was too long); I only used that name for the html element attribute.

But I named it exactly as @annevk described.

@othermaciej
Copy link
Collaborator

That naming logic seems too indirect to be obvious. It's true that inputmode is an indirect way of referencing the keyboard, but why not just reference it directly? I think knowing that this is about the return key on the keyboard is more important than knowing that this affects something that is also affected by the inputmode attribute. (That said, this is kind of bikeshedding).

@domenic
Copy link
Member

domenic commented Mar 8, 2018

Personally I'm leaning toward either inputmodeaction or inputaction. Note that this can appear on contenteditable elements or textarea elements or similar, so just action seems less good.

If we'd called inputmode keyboardmode instead, then something like keyboardaction would make sense. I'm not sure what the reasoning was there exactly, but at this point it'd be nice to be consistent in at least one dimension.

Does anyone have comments on the set of actions? I imagine @dtapuska has done the research on how they line up with various platforms, and platforms can always fall back to a default if not supported, but e.g. did anything get left out?

@annevk
Copy link
Member

annevk commented Mar 8, 2018

Given that this is global, action would conflict badly on form elements.

@Zirro
Copy link
Contributor

Zirro commented Mar 8, 2018

As someone encountering this attribute for the first time, I find the names ending with action to be confusing. I'd expect an attribute named inputaction to determine which action is invoked in a certain context, but this is only about the label/visual indicator.

Based on this, I would suggest names along the lines of actionlabel, enterlabel or keylabel instead.

@othermaciej
Copy link
Collaborator

actionlabel and enterlabel (or returnabel) all seem very on point given what this does.

@dtapuska
Copy link
Contributor Author

Ok I've renamed it inputactionlabel is that better? Being that it appears on the HTMLElement I think it needs "input" in the prefix.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good, but I found a couple of issues.

source Outdated
contenteditable</code>).</p>

<p>The <dfn><code data-x="attr-inputactionlabel">inputactionlabel</code></dfn> content attribute is an
<span>enumerated attribute</span> that specifies what kind of iconify for the enter key on
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/iconify/icon/?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe use "action label" throughout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

source Outdated

<p>User agents can support the <code data-x="attr-inputactionlabel">inputactionlabel</code> attribute
on form controls (such as the value of <code>textarea</code> elements), or in elements in an
<span>editing host</span> (e.g., using <code data-x="attr-contenteditable">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot break after a tag, that'll add whitespace to its contents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

source Outdated

<p>When <code data-x="attr-inputactionlabel">inputactionlabel</code> is unspecified (or is in a state not
supported by the user agent), the user agent should determine the default action type to be
shown. Contextual information such as the <code data-x="attr-inputmode">inputmode</code>, input
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop input here since it's not part of the attribute name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

source Outdated
<p>When <code data-x="attr-inputactionlabel">inputactionlabel</code> is unspecified (or is in a state not
supported by the user agent), the user agent should determine the default action type to be
shown. Contextual information such as the <code data-x="attr-inputmode">inputmode</code>, input
<code data-x="attr-input-type">type</code> or <code data-x="attr-input-pattern">pattern</code> attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oxford commas please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

source Outdated
<tbody>
<tr>
<td><dfn><code data-x="attr-inputactionlabel-keyword-enter">enter</code></dfn>
<td>The user agent should display a visual queue of the operation 'enter'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "visual cue"? Why visual though? Presumably assistive technology can also use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh yes. it should be cue. I've removed visual and display and used the verb present.

@annevk annevk added topic: forms and removed needs implementer interest Moving the issue forward requires implementers to express interest labels Aug 27, 2018
@annevk annevk added the needs tests Moving the issue forward requires someone to write tests label Aug 30, 2018
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with my own nits applied (please double check), but needs tests and implementation bugs before merging.

Thanks for pushing this forward!

@domenic
Copy link
Member

domenic commented Aug 30, 2018

@rniwa / @othermaciej, are you happy with the name inputactionlabel?

@othermaciej
Copy link
Collaborator

inputactionlabel seems better than the original inputmodeaction. But it still seems a little hard to understand what it does from the name alone. If I was reading it without context, I'd wonder "what exactly is an input action, and why would I label it?" I still think super literal names like returkeylabel are better in this regard.

I understand the desire to use input as a sort of prefix for a set of related properties, to make the tie to inputmode. But I don't think that works here. The natural way to interpret the word "input" in these attribute names is as an adjectival noun modifying the following word, not as a category prefix. That's the way it works in inputmode, where it modifies the word "mode" to explain what type of mode. "input mode" is a pre-existing widely understood term. But "input action" is not a commonly used term, and if there even was such a term, there isn't an intent to refer to it here. That's what makes it a bit mysterious to read.

If it came down to it I don't think we'd hold off on implementing based on the name alone. It doesn't seem like the most important aspect of this feature. But I thought I'd share my view nonetheless.

Added previous keyboard somehow it never made it in
@domenic
Copy link
Member

domenic commented Sep 11, 2018

LGTM! Ready to merge once we have some tests to link to. As with inputmode I anticipate the tests will be pretty basic, just testing the reflection I guess.

@sideshowbarker sideshowbarker added the impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation label Sep 11, 2018
@annevk
Copy link
Member

annevk commented Sep 12, 2018

Unless I missed something we'll also need implementation bugs.

@dtapuska
Copy link
Contributor Author

Are these good enough?

https://bugzilla.mozilla.org/show_bug.cgi?id=1490661
https://crbug.com/634330

@domenic
Copy link
Member

domenic commented Sep 12, 2018

Will need WebKit and Edge too. See https://github.com/whatwg/meta/blob/master/MAINTAINERS.md#handling-pull-requests . (We should probably move that to CONTRIBUTING.md, not just MAINTAINERS.md...)

@dtapuska
Copy link
Contributor Author

Done...

Edge https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/18970983/
Safari https://bugs.webkit.org/show_bug.cgi?id=189546

@dtapuska
Copy link
Contributor Author

Web platform tests are included in Chrome's implementation CL here: https://chromium-review.googlesource.com/c/chromium/src/+/1221696

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 12, 2018
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 12, 2018
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
@domenic domenic removed the needs tests Moving the issue forward requires someone to write tests label Sep 12, 2018
@domenic domenic merged commit a5422d9 into whatwg:master Sep 12, 2018
@Halochkin
Copy link

Halochkin commented Dec 25, 2018

Does it make sense? Nowadays smartphones have virtual keyboards with just "↵" symbol on enter key instead text value.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 7, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 17, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 17, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 21, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 21, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1221696
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661904}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request May 21, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1221696
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661904}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 19, 2019
…t., a=testonly

Automatic update from web-platform-tests
Add experimental support for enterKeyHint.

enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try​:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1221696
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661904}

--

wp5At-commits: 74870bb3fbf231c8b89f529fbfea7f22ad149c33
wpt-pr: 16718
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request Jun 19, 2019
…t., a=testonly

Automatic update from web-platform-tests
Add experimental support for enterKeyHint.

enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try​:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1221696
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661904}

--

wp5At-commits: 74870bb3fbf231c8b89f529fbfea7f22ad149c33
wpt-pr: 16718
@sideshowbarker sideshowbarker changed the title Add support for inputmodeaction. Add support for 'enterkeyhint' attribute (was 'inputmodeaction') Jun 22, 2019
@sideshowbarker
Copy link
Contributor

heads-up @whatwg/documentation

@chrisdavidmills
Copy link

MDN documentation need recorded at https://trello.com/c/aBs1o6Pg/86-dom-general-enhancements-fx-68

marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 23, 2019
enterKeyHint allows customization of the virtual keyboard enter
key. Enabled behind a flag since it isn't approved to ship yet.

Spec:
whatwg/html#3538

BUG=634330

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I32b510d8157e0c676300a38bb4c7fa2bbced0b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1221696
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661904}
@hober
Copy link
Collaborator

hober commented Oct 30, 2019

Support in WebKit landed in r251720.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation topic: forms
Development

Successfully merging this pull request may close these issues.

None yet