Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

validation of dcc.Input with type="number" makes entering negative numbers difficult #455

Closed
ned2 opened this issue Feb 3, 2019 · 2 comments
Assignees
Labels
dash-type-bug Something isn't working as intended size: 2
Milestone

Comments

@ned2
Copy link
Contributor

ned2 commented Feb 3, 2019

When a dcc.Input component has type="number", it's difficult to get the field to accept negative numbers due to the client-side validation. A - character is not permitted unless it precedes a number, which means you have to to enter the digits of your desired number first, before moving the cursor to the start of the field and entering the - character.

When the last character in the field is deleted the field's contents are also immediately set to 0, which I find incurs some amount of cognitive friction when editing the field's contents. I'm guessing both these properties of the validation are intended to always ensure the current value of the field is a valid number, however this comes at the cost of usability I think. I also wonder how important this invariant is to maintain given that an invalid (ie non-numeric) value can be set as an initial value in the layout and therefore can be sent through to the callback.

@Marc-Andre-Rivet
Copy link
Contributor

@ned2 Thanks for pointing this issue out. Agree that usability is taking a toll here and needs to be improved -- something as simple as behaving like a normal <input type='number' /> would be better.

@Marc-Andre-Rivet
Copy link
Contributor

Discussion about the feature's details in the PR, starting around:
#580 (review)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dash-type-bug Something isn't working as intended size: 2
Projects
None yet
Development

No branches or pull requests

3 participants