fix(dashboard): remove stray focus outline on Filter Badge popover (closes #38789)#41398
fix(dashboard): remove stray focus outline on Filter Badge popover (closes #38789)#41398rusackas wants to merge 1 commit into
Conversation
The FiltersDetailsContainer wrapper inside the Filter Badge popover is
focused programmatically (it has tabIndex={-1}) so it can capture keyboard
events for arrow-key navigation between filter indicators. After a page
refresh, opening the popover triggers the browser's :focus-visible
heuristic on that programmatic .focus() call and draws a default blue
focus ring around the entire popover container.
Suppress the default outline on the non-interactive wrapper for both
:focus and :focus-visible. The focusable items inside (FilterItem) keep
their own :focus-visible styles, so keyboard accessibility is unchanged.
Adopts anandraiin3#18 (authored via Devin AI). Original work by
@anandraiin3.
Closes apache#38789
Co-Authored-By: Devin AI <devin-ai-integration[bot]@users.noreply.github.com>
Code Review Agent Run #11c5ecActionable Suggestions - 0Additional SuggestionsFiltered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules. Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41398 +/- ##
=======================================
Coverage 64.44% 64.44%
=======================================
Files 2655 2655
Lines 145473 145473
Branches 33575 33575
=======================================
Hits 93747 93747
Misses 50027 50027
Partials 1699 1699
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
SUMMARY
Adopts anandraiin3#18 (authored via Devin AI). Original work by @anandraiin3 — credit to them; this PR rebases that fix cleanly onto current
masterwith the regression test intact.After a page refresh, hovering over the Filter Badge on a dashboard chart drew a default blue browser focus ring around the entire "Applied filters" popover.
Root cause: The popover content is wrapped by
FiltersDetailsContainerinsuperset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx. That wrapper hastabIndex={-1}and is focused programmatically byFiltersBadge/index.tsxwhenever the popover opens, so it can capture arrow-key / Escape / Enter events for keyboard navigation between filter indicators:After a refresh there has been no prior mouse interaction with the document, so the browser's
:focus-visibleheuristic treats this programmatic.focus()as keyboard-like and paints the user-agent focus outline. The wrapper<div>had nooutlinerule, so the blue ring leaked through. Once the user clicks anywhere the heuristic flips and the ring disappears — which is why it only reproduces after refresh.Fix: Suppress the default browser outline on
FiltersDetailsContainerfor both:focusand:focus-visible. The container is a non-interactive wrapper used only as a keyboard-event target; the actual focusable items inside (FilterItem) keep their own:focus-visiblestyles, so keyboard accessibility for the items inside the popover is unchanged. This is the minimum change required — the existing programmatic-focus-trap behaviour that powers arrow-key navigation is preserved.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: a blue focus ring is drawn around the entire popover container on hover after refresh (see the recording on #38789).
After: no focus ring is drawn around the popover wrapper; the popover renders with only its own background/elevation styling, matching the rest of the Superset UI.
TESTING INSTRUCTIONS
Manual:
Tabto focus the badge andEnterto open the popover via keyboard, then use Arrow Up/Down to navigate between indicators — keyboard navigation still works, and the focused item retains its own:focus-visiblestyling.Automated:
superset-frontend/src/dashboard/components/FiltersBadge/DetailsPanel/DetailsPanel.test.tsx:Popover container suppresses default browser focus outline— assertsoutline: noneis set on both:focusand:focus-visibleof the popover container (role="menu").masterwithout the style change and passes with it.npm run test -- src/dashboard/components/FiltersBadge/DetailsPanel/DetailsPanel.test.tsxADDITIONAL INFORMATION
Adopted from anandraiin3#18 (authored via Devin AI). Original author: @anandraiin3.