-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Form] Fix moneytype step #62621
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
[Form] Fix moneytype step #62621
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
I wonder, should it also duplicate the line regarding inputmode like numbertype does? See https://github.com/symfony/form/blob/a8f32aa19b322bf46cbaaafa89c132eb662ecfe5/Extension/Core/Type/NumberType.php#L49 and https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inputmode for reference. |
|
Thanks for the suggestion! You're right — NumberType sets the inputmode attribute when html5 is disabled, to help browsers provide the appropriate numeric keyboard. I'll update MoneyType to match the same behavior: I’ll push the update shortly. |
4d030fc to
e6b8bcb
Compare
|
Test failures look related 🤔 |
e6b8bcb to
768d170
Compare
|
Thank you @crownbackend. |
|
Thank you for running the tests. I didn’t have the time to do it last night. Sorry for the inconvenience, and thanks again for the merge. |
|
Kudos to you both, thanks! |
This PR fixes an inconsistency between
MoneyTypeandNumberTypewhen thehtml5option is enabled.NumberTypeautomatically adds astep="any"attribute when none is provided, which allows decimal input in browsers.MoneyTypedid not add this attribute, causing inconsistent behavior and preventing decimal input in some cases.What this PR does
step="any"whenhtml5istrueand no custom step is setMoneyTypebehaves likeNumberTypeTests
A new test has been added to ensure the behavior is correctly applied and will not regress.
Why it matters
This improves consistency across form types and fixes a long-standing UX issue mentioned in #62620.