Skip to content

[Form] don't add the inputmode attribute on fields whose type is the same #36869

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

Merged
merged 1 commit into from
May 22, 2020
Merged

[Form] don't add the inputmode attribute on fields whose type is the same #36869

merged 1 commit into from
May 22, 2020

Conversation

MatTheCat
Copy link
Contributor

@MatTheCat MatTheCat commented May 19, 2020

Q A
Branch? 5.1
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #34986
License MIT

These is no need to add the inputmode attribute on fields whose type is the same.

From https://html.spec.whatwg.org/multipage/interaction.html#attr-inputmode

When inputmode is unspecified (or is in a state not supported by the user agent), the user agent should determine the default virtual keyboard to be shown. Contextual information such as the input type or pattern attributes should be used to determine which type of virtual keyboard should be presented to the user.

From https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

tel
Inputs that require a telephone number should typically use <input type="tel"> instead.

search
Inputs that require a search query should typically use <input type="search"> instead.

email
Inputs that require email addresses should typically use <input type="email"> instead.

As such there is no point in adding inputmode for those types.

Symfony’s UrlType uses inputmode only when the type has to be text because the default_protocol option is set.

@MatTheCat MatTheCat requested a review from xabbuh as a code owner May 19, 2020 09:34
@MatTheCat MatTheCat changed the title Revert https://github.com/symfony/symfony/pull/34986 [Form] Revert https://github.com/symfony/symfony/pull/34986 May 19, 2020
@MatTheCat MatTheCat changed the title [Form] Revert https://github.com/symfony/symfony/pull/34986 [Form] Revert #34986 May 19, 2020
@nicolas-grekas
Copy link
Member

/cc @fre5h WDYT?

@xabbuh xabbuh added the Form label May 19, 2020
@fre5h
Copy link
Contributor

fre5h commented May 19, 2020

I rechecked it on iOS mobile browsers. Works well. I mean only type without inputmode. I'm not sure that it is really a bug, that inputmode was added. Because inputmode attribute is still a part of HTML standard, it is not deprecated, it does not perform any negative side effects for form rendering.

@MatTheCat
Copy link
Contributor Author

Indeed it’s not a bug, nor a feature. It basically added code for nothing so I believe it is okay to remove it.

@nicolas-grekas nicolas-grekas added this to the 5.1 milestone May 22, 2020
@nicolas-grekas nicolas-grekas changed the title [Form] Revert #34986 [Form] don't add the inputmode attribute on fields whose type is the same May 22, 2020
@nicolas-grekas nicolas-grekas changed the base branch from master to 5.1 May 22, 2020 08:06
@nicolas-grekas nicolas-grekas changed the base branch from 5.1 to master May 22, 2020 08:06
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(for 5.1)

@fabpot fabpot changed the base branch from master to 5.1 May 22, 2020 17:16
@fabpot
Copy link
Member

fabpot commented May 22, 2020

Thank you @MatTheCat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants