{{ message }}
Fix decimal and float inputs rejecting locale decimal separator on Chromium#27189
Open
Tokonigeorge wants to merge 2 commits intodirectus:mainfrom
Open
Fix decimal and float inputs rejecting locale decimal separator on Chromium#27189Tokonigeorge wants to merge 2 commits intodirectus:mainfrom
Tokonigeorge wants to merge 2 commits intodirectus:mainfrom
Conversation
Signed CLA via contributors.yml entry. Fixes directus#24803
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Scope
What's changed:
<input type="text" inputmode="decimal">instead of<input type="number">, so the app locale's decimal separator (e.g.,innl-NL,de-DE) is accepted consistently across browsers.Intl.NumberFormat), and user input is normalised back to.before emission, matching the existing text+float path.<input type="number">with native spinner arrows.Why the change
Chromium-based browsers (Chrome, Edge, Safari) ignore the
langattribute on<input type="number">and always require.as the decimal separator, regardless of the user's OS locale or anylangwe set on the element (see Chromium issue 40593334). Users on comma-locale browsers therefore couldn't enter300,44into a Decimal field, the browser rejected it with "not a number" before the value ever reached Directus code. Because the bug was in the browser's validity layer, a small fix inv-input.vuealone couldn't solve it; the field had to stop beingtype="number"altogether for float/decimal.Potential Risks / Drawbacks
v-input.vue(gated ontype === 'number') are gone for these field types. Integer fields still have them.type="number". A JS-side handler could restore this; left as a possible follow-up to keep this PR focused on the bug.min/max/stepvalidation is no longer enforced by the browser for float/decimal. The existing keydown filter (regexValidFloat, non-numeric key blocking) still prevents junk input, and server-side validation is unaffected.numbertostringfor float/decimal. The API coerces string → numeric on insert/update for decimal/float columns, and the round-trip was verified end-to-end against SQLite.Tested Scenarios
Repro (before fix)
nl-NL) or German (de-DE).300,44into the field, the browser shows "Geen getal" ("not a number") and blocks input on Chrome/Safari/Edge.After fix — verified locally on Chrome with SQLite backend
300,44→ accepted, no warning → saved → DB stores300.44(numeric) → reopen shows300,44✅300.44, typing and saving works, DB stores300.44✅<input type="text" inputmode="decimal">with nolangattribute; integer fields still<input type="number">✅v-input.test.ts(46) andinput.test.ts(20). New tests:300.44as300,44undernl-NL.300.44as-is underen-US.'300.45'when user types300,45undernl-NL.type="text"andinputmode="decimal"throughinput.vue.type="number"and noinputmode.Review Notes / Questions
300.44regardless of app locale). That would need changes to the display component and feels like a separate PR.ArrowUp/ArrowDowncould restore keyboard stepping for float/decimal inputs. Not done here to keep the diff minimal and focused on the reported bug.APP_NUMERIC_TYPES(['integer', 'float']) is still used elsewhere (get-js-type,slider,input/index.ts) for semantic field-type checks and is intentionally left intact, only the render-time dispatch ininput.vuewas changed.Checklist
Fixes #24803