Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 84c60475975224f44a23c1de430edd7721a998a1
https://github.com/WebKit/WebKit/commit/84c60475975224f44a23c1de430edd7721a998a1
Author: Lily Spiniolas <[email protected]>
Date: 2026-03-16 (Mon, 16 Mar 2026)
Changed paths:
A LayoutTests/fast/forms/number/number-l10n-input-visible-text-expected.txt
A LayoutTests/fast/forms/number/number-l10n-input-visible-text.html
M Source/WebCore/html/NumberInputType.cpp
M Source/WebCore/platform/text/PlatformLocale.cpp
M Source/WebCore/platform/text/PlatformLocale.h
Log Message:
-----------
REGRESSION (298613@main): Number inputs fail to display localized numbers
https://bugs.webkit.org/show_bug.cgi?id=309725
rdar://172112320
Reviewed by Wenson Hsieh, Aditya Keerthi, and Abrar Rahman Protyasha.
Before 298613@main, any text could be entered inside number inputs. If it
was a valid number, we would convert it according to the user's locale
into a standardized number format specified by the HTML spec.
Starting in 298613@main, characters can only be entered into number inputs
if they would not cause the value to become invalid. If the user's number
format uses commas instead of decimals as the decimal separator, and the
user types a number with a comma such as "1,2", we would correctly update
the value of the input to "1.2", but we would also display "1.2" instead of
displaying the localized number.
Now, if the user's locale indicates a non-period decimal separator, we allow
either the localized separator or a period to be entered AND displayed as the
separator (since using a period may still be desirable in certain contexts
such as mathematics).
In the presence of two potential separators, we use whatever comes last since
the first separators may indicate group separators rather than decimal
separators.
Test: fast/forms/number/number-l10n-input-visible-text.html
* LayoutTests/fast/forms/number/number-l10n-input-visible-text-expected.txt:
Added.
* LayoutTests/fast/forms/number/number-l10n-input-visible-text.html: Added.
* Source/WebCore/html/NumberInputType.cpp:
(WebCore::NumberInputType::handleBeforeTextInsertedEvent):
* Source/WebCore/platform/text/PlatformLocale.cpp:
(WebCore::Locale::localizeNumberCharacters):
* Source/WebCore/platform/text/PlatformLocale.h:
Canonical link: https://commits.webkit.org/309366@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications