Implement focusin/focusout events. #182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
Adds the focusin and focusout events. Fixes #179.
Sorry this PR took so long, I needed some personal time and wanted to make sure I was informed. The focusin/focusout events are described in two documents:
Why:
I added
document.addEventListener('focusin', handler);
to some of my React components. Indom-testing-library
, we can only trigger this handler by dropping down to the low-levelfireEvent(element, event)
API. For consistency, it'd be nice to provide a focusin/focusout convenience API like the other events.How:
events.js
, and making sure they bubble.Checklist:
events.js
file.)This is part of a bigger story around lack of focusin/focusout implementation: jsdom does not fire focusin/focusout events when focusing or blurring. And React does not expose focusin/focusout either.
Great library, BTW! Let me know if there's anything else I need to do. Thank you!