-
Notifications
You must be signed in to change notification settings - Fork 63
Fix popover not closing on Escape or click outside #2036
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/_preview/2036 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: -7.11 kB (-1%) Total Size: 852 kB
ℹ️ View Unchanged
|
Playwright Failure Test Results It looks like some of the Playwright tests failed. You can download the Playwright trace https://github.com/WordPress/openverse-frontend/actions/runs/3648644886 Read more about how to use this artifact here: https://github.com/WordPress/openverse-frontend/blob/main/test/playwright/README.md#debugging |
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.
I like the implementation, the new tests are lovely as well. LGTM.
Fixes
Fixes #2033 by @zackkrida
Description
The change that moved the focus trap from the VModal component into the useDialog composable failed to account for the fact that Popovers also use it, and don't need a focus trap.
This PR only activates/deactivates the focus trap if the
trapFocus
prop is set totrue
, and setstrapFocus
tofalse
for VPopover component.It also adds an e2e test for closing the popover on click outside and pressing Escape to the
homepage
e2e test (that's the simplest place where we can open a popover).Testing Instructions
Try running the app on desktop. Open the popovers (content switcher on the homepage, pages menu or content switcher in the header) and check that pressing Escape or clicking outside closes them.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin