8000 [Form] Add inputmode=email/numeric/search/tel to form types · Issue #45099 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[Form] Add inputmode=email/numeric/search/tel to form types #45099

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

Closed
GromNaN opened this issue Jan 20, 2022 · 4 comments · Fixed by #45101
Closed

[Form] Add inputmode=email/numeric/search/tel to form types #45099

GromNaN opened this issue Jan 20, 2022 · 4 comments · Fixed by #45101

Comments

@GromNaN
Copy link
Member
GromNaN commented Jan 20, 2022

Description

inputmode is an HTML atttibute for <input> tag that improve the UX on mobile by displaying an appropriate virtual keyboard based on the expected input. Reference on MDN

image

This attribute is already set on UrlType, only when default_protocol is configured (why?).

It should be added to other:

  • EmailType
  • NumberType
  • SearchType
  • TelType

Example

No response

@stof
Copy link
Member
stof commented Jan 21, 2022

That's done because <input type="email"> does not need an explicit inputmode=email. Browsers already do it.

When default_protocol is set, the UrlType renders as a <input type=text>, which is why we add inputmode.

@stof
Copy link
Member
stof commented Jan 21, 2022

See #36869 which reverted precisely the PR you are doing here (which is the same than #34986)

@welcoMattic
Copy link
Member

Ok for email, search and tel types, but it's still relevant for NumberType for which the inputmode must be explicitly set, right?

@stof
Copy link
Member
stof commented Jan 21, 2022

For a NumberType with the html5 option set to false, this might indeed be useful.

@fabpot fabpot closed this as completed Jan 22, 2022
fabpot added a commit that referenced this issue Jan 22, 2022
…tic)

This PR was merged into the 6.1 branch.

Discussion
----------

[Form] Add inputmode attribute on NumberType

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #45099
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Quick add of `inputmode` attribute on NumberType, let's discuss about this:

- Should it be the default?
- Should we add a way to not add the attribute?

Thank you @GromNaN for the issue, I had this idea in mind for a long time 😉

Commits
-------

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

Successfully merging a pull request may close this issue.

4 participants
0