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

Find workaround setSelectionRange with number inputs (ff 51+) #122

Closed
mickmcgrath13 opened this issue Feb 13, 2017 · 6 comments
Closed

Find workaround setSelectionRange with number inputs (ff 51+) #122

mickmcgrath13 opened this issue Feb 13, 2017 · 6 comments
Assignees
Labels

Comments

@mickmcgrath13
Copy link
Contributor

mickmcgrath13 commented Feb 13, 2017

FF 51.0.1+ throws and error when trying to use setSelectionRange on a number input.

Line that causes the error: https://github.com/bitovi/syn/blob/master/src/key.js#L310

Firefox Bug Reported: https://bugzilla.mozilla.org/show_bug.cgi?id=1339154

@mickmcgrath13
Copy link
Contributor Author

mickmcgrath13 commented Feb 13, 2017

Update: Reported Firefox bug might not be a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1333737

It specifies here and here.

Explained via w3.org comment here.

..still need a workaround, though

@justinbmeyer
Copy link
Member

The only work around will be to not update the cursor position. This means that keying left or right will not work. Lame ...

@justinbmeyer
Copy link
Member

Related whatwg/html#2358

@justinbmeyer
Copy link
Member

It seems the only recourse is to maintain an internal model of what the typing would result in and update the value and events accordingly.

@chasenlehara
Copy link
Member

chasenlehara commented Feb 17, 2017

@kdillon and I paired on this issue because this test is failing in Firefox right now.

For now, we’re changing this line to test for undefined and null, since selectionStart will be null in Firefox.

I don’t know if we still want to pursue a “workaround” for something that isn’t guaranteed by the spec. 😕

@chasenlehara
Copy link
Member

Closing this because I think it’s “fixed” with #124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants