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

♻️ remove firefox interval hack #11

Merged
merged 2 commits into from
Jan 15, 2022

Conversation

IanVS
Copy link
Contributor

@IanVS IanVS commented Jan 11, 2022

Fixes #10 (kind of)

This removes the setInterval for firefox, since it does not appear to be needed since firefox 55. I would suggest that if users need to support versions older than that, they can use something like https://github.com/2is10/selectionchange-polyfill. But calling a function every 16ms seems like overkill and a good way to drain batteries. I could be wrong about this, but it worked correctly in my version of firefox (95) in local testing.

I also updated the codesandbox slightly to fix an annoying chrome behavior, in which nothing appeared to be focused after resetting the input following an error. Maybe there's a better way to do that, but I couldn't find one.

Firefox has supported `selectionchange` since version 55.
@IanVS
Copy link
Contributor Author

IanVS commented Jan 12, 2022

I see you have a new PR with a more elegant way to change the selection. Is the Firefox change here worth considering? If so, I will remove the other commit.

@IanVS
Copy link
Contributor Author

IanVS commented Jan 13, 2022

@leonardodino what do you think about removing the firefox setInterval?

@leonardodino
Copy link
Owner

wow, great news! 🙌

When I first wrote this code, for a personal project ~1-2 years ago, it was needed. Even though Firefox had this event for a long while, it wasn't as precise as webkit/chromium, so it wasn't working for this use case, hence the interval hack 😅

I just updated my firefox install again to test it, and has since been fixed!
~6months ago, in firefox 92: https://bugzilla.mozilla.org/show_bug.cgi?id=1648944

@leonardodino leonardodino changed the title Remove firefox setInterval ♻️ remove firefox interval hack Jan 15, 2022
@leonardodino
Copy link
Owner

I've reverted the chrome that was in this PR, in favour of the one merged in #13
thanks for fixing this! 🙌

@leonardodino leonardodino merged commit 16507ee into leonardodino:main Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

First input is not focused after error, in chrome
2 participants