Skip to content

Fix number input type for values over 1000#2163

Merged
mvorisek merged 8 commits intodevelopfrom
input_number_with_space
Feb 21, 2024
Merged

Fix number input type for values over 1000#2163
mvorisek merged 8 commits intodevelopfrom
input_number_with_space

Conversation

@mvorisek
Copy link
Copy Markdown
Member

@mvorisek mvorisek commented Feb 7, 2024

UI numeric values/types are rendered using UI persistence and can contain non-numeric characters like space, comma.

repro

Currently, such correctly formatted UI values, are considered as bad, example:

image

can be reproduced on demos/form-control/multiline.php demo by writing 1 000 in "Qty" number input.

solution

The visual style is controlled by https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid CSS presudo class which is set by https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation . In short, input type=number cannot be used for anything else than \d+ value, thus we need to set type to be different than number or do not set it at all.

@mvorisek mvorisek force-pushed the input_number_with_space branch from 06f140e to 4da2d4b Compare February 20, 2024 13:48
@mvorisek mvorisek force-pushed the input_number_with_space branch from 4da2d4b to a3f39b7 Compare February 21, 2024 11:31
@mvorisek mvorisek force-pushed the input_number_with_space branch from a3f39b7 to 9e65828 Compare February 21, 2024 13:10
@mvorisek mvorisek marked this pull request as ready for review February 21, 2024 13:25
@mvorisek mvorisek merged commit a513757 into develop Feb 21, 2024
@mvorisek mvorisek deleted the input_number_with_space branch February 21, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant