-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 popover toggle buttons #30392
Fix popover toggle buttons #30392
Conversation
Size Change: +119 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
I'd been tinkering with an approach like that and made #30397. It has test failures at the moment but I believe they may all be snags on implementation detail. Relating to the implementation in this PR, I'd like to note that checking against |
If the button doesn't receive focus, will the blur event still happen? |
Yes because the button's closest focusable container gets focus. |
Oh, something I just remembered, buttons inside toolbars are receiving focus even in UAs that don't normally focus them (I think it's something done by ToolbarItem/reakit). This means all the toggles/popovers affected by this PR will work fine with the logic used. |
@stokesman So does this test well or is there anything missing? |
I tested today in Safari and the toggles in
But that was due to testing in Firefox and doesn't apply to Safari (though it is supposed to with reakit's focus normalization). So now it seems odd that this even works for I tried a couple of structure tweaks to the toolbar in Besides all that, I know of one more toggle that wants fixing, Format Library's link component. |
7f8cc7e
to
49f9bf7
Compare
Not sure if I jumped the gun but I tested this and it fixes what it's supposed to (tested in Safari and Chromium). Yet I did run into some trouble with the post date popover not closing when somewhere outside the block is clicked (both browers). Here's a recording: post-date-popover-dismissal.mp4 |
cbffcf8
to
6895cc1
Compare
Oh yeah, yet another new popover toggle which could use this treatment is in |
I'm back again 👋 . I just made #35024 to help break this up a bit. It fixes the toggle/popover combos in So if that PR looks good, between it and this one, I think we'd finally knock out all the misbehaving toggles. |
6895cc1
to
aebc03e
Compare
I assumed it'd be okay to rebase and fix conflicts here and did so. |
Description
Alternative to #27406.
I don't think there's a need to introduce another prop and public API to the Popover component. When
onClose
is called, we can check if the active element is the toggle button and let the toggle button handle closing instead. The Popover component should not concern itself with toggle buttons and what controls it.Ideally this should only be implemented once with a drop down or toggleable popover component instead of needing to handle this in different places.
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).