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 inputmode global HTML attribute #2573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ddbeck
Copy link
Collaborator

@ddbeck ddbeck commented Jan 24, 2025

One thing that I know is an issue:

Safari's reported support differs between caniuse and BCD. Honestly, I don't know who's "wrong" in this scenario—it's not clear to me how to test whether an attribute is invalid, if there's no discernible behavior anyway.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Jan 24, 2025
@captainbrosset
Copy link
Contributor

I think BCD is correct here. inputmode is implemented in Safari across macOS and iOS. It's just a lot more visible on iOS because of the virtual keyboard. But, even on macOS the attribute does have an effect. I just tested and I get a different suggestion popups on input fields with inputmode=tel and inputmode=email than I do on other types of inputs.

The point here is that the spec doesn't say exactly what should happen. This is for the user agent to decide, depending on what works best for the user, on the particular device they're using. It makes no sense for Safari on macOS to change the keyboard, because it's a physical keyboard, so instead they use the inputmode attribute to offer some contextual auto-completion help.

Either way, the attribute, and reflected DOM property, does work on Safari macOS too.

@@ -0,0 +1,7 @@
name: inputmode
description: The `inputmode` global HTML attribute gives a hint about what type of data is to be entered into an `<input>` element, such as `text`, `numeric`, or `email`, so the browser may choose a virtual keyboard.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: The `inputmode` global HTML attribute gives a hint about what type of data is to be entered into an `<input>` element, such as `text`, `numeric`, or `email`, so the browser may choose a virtual keyboard.
description: The `inputmode` global HTML attribute gives a hint about what type of data is to be entered into an `<input>` element, such as `text`, `numeric`, or `email`, so the browser may help the user enter data using an adapted input mechanism, such as an on-screen virtual keyboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants