Skip to content
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

[TextField] Can not enter decimal separator (Safari) #163

Closed
pekeler opened this issue Dec 31, 2023 · 7 comments
Closed

[TextField] Can not enter decimal separator (Safari) #163

pekeler opened this issue Dec 31, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@pekeler
Copy link

pekeler commented Dec 31, 2023

When entering a . or , as in 12.34, the value gets deleted.

@pekeler
Copy link
Author

pekeler commented Dec 31, 2023

(This is in Safari 17.1, seems to work fine in Chrome)

@techniq techniq changed the title Can't enter decimal separator in decimal TextField Can't enter decimal separator in decimal TextField (Safari) Dec 31, 2023
@techniq techniq added the bug Something isn't working label Dec 31, 2023
@techniq
Copy link
Owner

techniq commented Dec 31, 2023

Thanks for the report @pekeler. Yeah, it appears to only affect Safari (also tested Firefox).

My first thought was how Safari might he handling Number('12.') but it looks consistent with Chrome.

Chrome Safari
image image

I've had a note to improve this functionality. Hopefully I (or someone else) can get to it soon. The current workaround is not using type="decimal" and manually converting the value.

I do wonder if some of this handling is needed, or shouldn't be replaced with e.target.valueAsNumber (although Svelte already does this for <input type="number" bind:value >.

@techniq techniq changed the title Can't enter decimal separator in decimal TextField (Safari) [TextField] Can not enter decimal separator (Safari) Jan 1, 2024
@dimfeld
Copy link
Contributor

dimfeld commented Jan 4, 2024

Hmm, this doesn't reproduce for me, using Safari 17.2.1. I just tried it with the sample decimal TextField in the docs site.

@dimfeld
Copy link
Contributor

dimfeld commented Jan 4, 2024

Posted this on the Discord, but here for the record. This appears to be a bug in Safari 17.1, fixed in 17.2
image

@techniq
Copy link
Owner

techniq commented Jan 4, 2024

not returning the correct value

You could say that :)

image

@techniq
Copy link
Owner

techniq commented Jan 4, 2024

@pekeler I'm going to close this as I don't see a way to workaround it otherwise, and at least it's resolved in the latest Safari release :)

@techniq techniq closed this as completed Jan 4, 2024
@pekeler
Copy link
Author

pekeler commented Jan 5, 2024

Makes sense. Thanks.

(Safari is my default browser. Quite interesting I never noticed this browser bug on any other site. I guess almost nobody is using real number inputs and does their own parsing instead.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants