-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: add support for react portal elements #107
fix: add support for react portal elements #107
Conversation
This is very interesting! I'm leaning on accepting these changes but would like to hear what others have to say about it... |
To add some context, #62 has a discussion about how this is possible today with some workaround (probably similar to what this PR brings out-of-the-box, haven't made a thorough comparison). |
Perhaps we could expose some additional queries on a namespace: const {inBody} = renderIntoDocument(<Stuff />)
const submitButton = inBody.getByText('Submit') |
But I'm not sure I like that either. I'm thinking the solution in #62 is very straightforward and prefer that over bloating the API further. Use cases for portals are few and far between so I don't think it's worth the extra overhead. |
I'd prefer not to bloat the API for this. By documentation, |
That makes sense to me. Ok, I'm in favor of this change. Let's make a change to the docs to explain this as well. |
1861087
to
36ff384
Compare
🎉 This PR is included in version 3.1.5 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
…tton-click fix: 🐛 don't fire events when clicking disabled radio button
What:
Components like modals, dialogs, hovercards, tooltips etc use React portals to render them into
document.body
. Testing utilities can query only on the container and this cannot do testing in such components.Why:
This fix is necessary to test components that uses react portals.
How:
When using
renderIntoComponent
, instead of exposing test utilities for container, we do it fordocument.body
which contains the container.Checklist: