-
Notifications
You must be signed in to change notification settings - Fork 10
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
WB-1654: Popover trigger element is stealing focus from other focusable elements [FIX] #2162
Conversation
🦋 Changeset detectedLatest commit: 77b8fc2 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 |
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
Size Change: +67 B (0%) Total Size: 92.6 kB
ℹ️ View Unchanged
|
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (fa4bf14) and published all packages with changesets to npm. You can install the packages in webapp by running: ./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2162" Packages can also be installed manually by running: yarn add @khanacademy/wonder-blocks-<package-name>@PR2162 |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2162 +/- ##
==========================================
+ Coverage 94.90% 96.27% +1.37%
==========================================
Files 245 245
Lines 28442 28459 +17
Branches 2344 2396 +52
==========================================
+ Hits 26992 27399 +407
+ Misses 1450 1060 -390
... and 41 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
A new build was pushed to Chromatic! 🚀https://5e1bf4b385e3fb0020b7073c-vyrihhlonw.chromatic.com/ Chromatic results:
|
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.
oof, this is tricky! thanks for the fix.
Summary:
As soon as a popover is closed, we return focus to its trigger element (or
element that caused the popover to open). This works fine in most cases, but
there are situations where we don’t want to do that.
For example, when there are multiple Popovers within the same context and the
user opens a separate popover, the previous opened popover closes, but in this
case the focus is being moved from the new popover to the trigger element of the
previous popover.
This PR fixes this by detecting if the element that caused the popover to be
dismissed is an element that can be focused, and if so, we let the focus flow
naturally to that element. If not, we return focus to the trigger element.
Issue: https://khanacademy.atlassian.net/browse/WB-1654
Test plan:
the first popover closes and the second popover opens.
first popover.