-
-
Notifications
You must be signed in to change notification settings - Fork 212
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(dialog,popover): restore focus when open
set to false
#1110
fix(dialog,popover): restore focus when open
set to false
#1110
Conversation
🦋 Changeset detectedLatest commit: d58ea38 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing! Thanks man!
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
@huntabyte I added an options parameter to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
open
to false
open
set to false
closes #1109
We now restore focus to the trigger (or using the
closeFocus
prop) in aneffect
that runs whenopen
isfalse
. In order to not focus the trigger on initial mount whenopen
isfalse
, I added a parameterskipFirstRun
to theeffect
function that optionally skips the first run of the effect.I also added regression tests for the dialog and popover.
Also, in the menu builder, we are already doing what I implemented with the dialog and popover, which removes the need in the menu builder to manually focus the trigger in multiple places. And I cleaned up the effect in the menu component.
Dialog Before
Screen.Recording.2024-03-20.at.1.58.50.PM.mov
Dialog After
Screen.Recording.2024-03-20.at.1.59.18.PM.mov
Popover Before
Screen.Recording.2024-03-20.at.1.41.15.PM.mov
Popover After
Screen.Recording.2024-03-20.at.1.42.38.PM.mov