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

Fixes issues where input was being refocused when the window is blurred and refocused #212

Merged
merged 1 commit into from
Dec 13, 2016

Conversation

majapw
Copy link
Collaborator

@majapw majapw commented Dec 13, 2016

Fix for #120

So we've spent a bit of time digging around and the main issue is that when you leave the page and then return, document.activeElement is still the <input /> and so it triggers the focus listener. Our original instinct was just to blur the input when the window itself was blurred, we realized eventually that the real issue is that what is focused according to our react code is getting out of sync with what is focused according to the DOM.

We already had some code that would focus and select the input if that's the way props.focused had changed... so now we've added some code that blurs the input if props.focused had changed to false. This seems to solve #120 pretty completely (for both the SDP and the DRP).

to: @ljharb @backwardok
cc: @jkudish @Valentin1918

@majapw majapw added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Dec 13, 2016
@jkudish
Copy link

jkudish commented Dec 13, 2016

Nice! Good fix 👍

@majapw majapw force-pushed the maja-fix-weird-refocus-issue branch from ca926b0 to 1a0d030 Compare December 13, 2016 23:01
@majapw majapw force-pushed the maja-fix-weird-refocus-issue branch from 1a0d030 to 9e6e89b Compare December 13, 2016 23:02
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9e6e89b on maja-fix-weird-refocus-issue into ** on master**.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 86.51% when pulling 9e6e89b on maja-fix-weird-refocus-issue into 39ac94b on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 86.51% when pulling 9e6e89b on maja-fix-weird-refocus-issue into 39ac94b on master.

@majapw majapw merged commit bd0f9e2 into master Dec 13, 2016
@majapw majapw deleted the maja-fix-weird-refocus-issue branch December 13, 2016 23:38
@jkudish
Copy link

jkudish commented Dec 13, 2016

glad to see this merged @majapw, thank you!

will you be making a release soon? or should I pull from master?

@majapw
Copy link
Collaborator Author

majapw commented Dec 13, 2016

Doing a release as we speak!

@jkudish
Copy link

jkudish commented Dec 13, 2016

so much awesome

@majapw
Copy link
Collaborator Author

majapw commented Dec 13, 2016

v4.1.1 is live! :)

This was referenced Dec 14, 2016
@backwardok
Copy link
Contributor

Note that this caused #937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants