-
Notifications
You must be signed in to change notification settings - Fork 470
focusIn, focusOut, and resize events #179
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
Comments
Thanks! If it's standard, then it should probably be included. Yes, please do make a PR! Thank you. |
🎉 This issue has been resolved in version 3.16.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Looks like |
Resize events are unique because they can only be fired on |
FWIW, I managed to fire a resize event in a test like this: fireEvent(window, new Event('resize')) Maybe fireEvent.resize(event) having the first argument be the event and not supporting passing the target element. |
I had a similar issue with
Another problem with |
Yup, makes sense. Then maybe leaving the same interface and warning about the target not being a window. That's fine with me. |
Introducing resize event in #990 |
Describe the feature you'd like:
fireEvent.focusIn
andfireEvent.focusOut
seem to be missing. I didn't know if there was a reasoning for it, so I wanted to double-check with y'all. Here's the documentation on focusin: https://developer.mozilla.org/en-US/docs/Web/Events/focusinAdditionally,
fireEvent.resize
is missing. This one is a bit weirder, though, so rather than suggest anything, I'm asking if it belongs in here.Suggested implementation:
Note that
focusIn
andfocusOut
bubble, unlike focus and blur.In the case of
resize
, it's a little weird. You want to call it on aWindow
. The magic function that gets assigned to all these events tries to find the window viaconst window = node.ownerDocument.defaultView
, which does an angry tableflip if you pass it a window in the first place. So some ceremony can be skipped:But seeing as it's a little different than the rest and a one-liner I'm not bothered if y'all think adding resize is a bad idea.
I'm happy to make a PR for either.
Describe alternatives you've considered:
We can just use the low-level version (i.e. just
fireEvent
) in all cases, but it'd be nice to have the convenience functions for a consistent API.Teachability, Documentation, Adoption, Migration Strategy:
Documentation is sparse; I think the library just links to
src/events.js
.Thoughts? 😄
The text was updated successfully, but these errors were encountered: