-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<input type="number"> does not support full-width numbers (e.g., "ー200") for Japanese IME users #47095
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
base: main
Are you sure you want to change the base?
<input type="number"> does not support full-width numbers (e.g., "ー200") for Japanese IME users #47095
Conversation
EWS run on previous version of this PR (hash c9d4536) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem correct to me. I don't think we should convert whatever is assigned to the value
setter. Instead we should convert what the end user types in before changing the underlying value.
We probably also want web-platform-tests to ensure other browsers do it in the same way.
Thanks for the clarification — you're absolutely right from the HTML spec perspective. This patch currently applies normalization even when assigning full-width characters via Interestingly, Firefox does accept As I understand it, Web Platform Tests (WPT) are meant to test only behavior that is explicitly specified in the HTML standard. So if we restrict normalization in WebKit to occur only during native keyboard input, that behavior would fall outside the spec — and therefore outside the scope of WPT. Similarly, the current LayoutTests covering this would no longer be valid unless the behavior is spec-defined. With that in mind, I'd like to ask: I'm happy to help draft a spec proposal or open an issue on WHATWG if that's of interest. |
That makes sense to me, here's what I'd suggest:
|
Thanks so much for the quick and helpful reply — really appreciate it. I've never proposed a change to the HTML spec before, so it might take me a bit of time to navigate the process, but I'm happy to take a shot at it. In the meantime, I'll keep this pull request on hold until we see how the spec discussion evolves. |
Thank you for improving this part of the web! If you fill out "New issue" at https://github.com/whatwg/html/issues/new/choose with the basic information I'm happy to copy the relevant people. I suspect people will agree though it might take a while to get everyone to comment, so you could do some of the other work in parallel. |
I've opened a WHATWG HTML issue to propose this behavior formally: Thank you again for your feedback and support! |
Proposal: Improve number input sanitization to match Chromium behaviorWhile reviewing and updating the Specifically, Chromium's
In contrast, WebKit currently only normalizes some characters and allows others to remain in the field, which can result in invalid floating-point representations. Given that the HTML specification states that:
... it seems appropriate to consider aligning WebKit's sanitization more closely with Chromium's stricter approach. Current progressSo far, I have implemented an initial version of normalization that:
This approach is working well in early testing and ensures that scripted Proposed next steps
Since building and testing these changes locally is time-consuming, I'm leaving this note here to track the proposal and current progress before proceeding with a full patch. Reference: Chromium's HandleBeforeTextInsertedEvent implementation Please let me know if there are any objections, suggestions, or related efforts before moving forward. |
This comment was marked as resolved.
This comment was marked as resolved.
…0") for Japanese IME users https://bugs.webkit.org/show_bug.cgi?id=284363 Reviewed by NOBODY (OOPS!). This patch adds normalization support for full-width digits, the minus sign variants (U+FF0D, U+30FC, U+2212), and the full-width full stop (U+FF0E) by mapping them to their ASCII equivalents (e.g., U+002D for minus, U+002E for dot) when handling typed input in <input type=number> fields. These characters are commonly produced by Japanese IMEs when entering numeric values. In addition, like Chromium, disallowed characters are now rejected, and normalization is applied immediately after input.
c9d4536
to
e782662
Compare
EWS run on current version of this PR (hash e782662) |
I’ve implemented the behavior for now. I’ll write tests and additional improvements afterwards. |
c9d4536
e782662
🛠 playstation