-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Numberinput cannot input .0 after any number. #1873
Comments
Can you provide sample code? |
It's does not appear to be an operating system issue. Chrome & Firefox do not have this issue on MacOS. Safari 17 (macOS Sonoma) does truncate. Behavior is different from plain number input which does not seem to ever truncate. There also appears to be an issue that pressing backspace can delete decimal places and
to
There probably needs to be some logic to prevent the input value from being forcibly updated. |
I wonder if explicitly setting a <NumberInput value={1} step={0.1} label="Clusters" /> |
It does not; already suspected and tried that. (Plain number input does not need it either.) |
I don't have all of the different OS's to try on, but binding to the input value instead of setting it inside the on:input event handler seems to help with some of the issues identified by brunnerh; in particular I was experimenting for a remedy to the cursor jumping in Chromium browsers. I just lack the ability to test on Mac/Safari which the comment thread started with, so I'm hesitant to make a PR. I see the binding of the value was also attempted in another open PR #1584 (comment), but I think the binding alone could be done as a non-breaking change. |
This issue affects Firefox, Safari, Chrome, Chromium on desktop and mobile. When pressing backspace once for value, Based on code, it appears to be parsing for number on every input. This could be causing this unusual issue. carbon-components-svelte/src/NumberInput/NumberInput.svelte Lines 140 to 142 in 44a2989
Perhaps the parsing is done to ensure I'd make a PR, but I don't understand the full implications of removing the |
Parsing exists so the value property and event data can be a |
We had issues with this and similar behaviour in different browsers in our project. For us it was mostly the issue that backspace with the cursor at the end on 1.4 or similar moves the cursor to start instead. For example: Try changing value 2.8 to 2.1:
We fixed it by making our own custom component which checks for previous value to make sure how to handle input changes. |
I had an issue related to that topic: |
commenting to say I would appreciate a fix for this. We are running into the backspace issues in chrome. |
On mac, in Numberinput, we cannot input .0 after any number.
Inputting 1.0 immediately forces it to 1
But Android can it. Other is unknown.
The text was updated successfully, but these errors were encountered: