Skip to content

fix(a11y): WCAG 2.4.7 — ensure visible keyboard focus on all interactive elements - #39242

Closed
Aitema-gmbh wants to merge 1 commit into
apache:masterfrom
aitema-de:fix/wcag-2.4.7-focus-visible
Closed

Aitema-gmbh wants to merge 1 commit into
apache:masterfrom
aitema-de:fix/wcag-2.4.7-focus-visible

Conversation

@Aitema-gmbh

Copy link
Copy Markdown
Contributor

SUMMARY

Implements WCAG 2.1 criterion 2.4.7 (Focus Visible, Level AA).

  • Add global *:focus-visible rule with 2px solid outline using theme primary color
  • Replace all outline: none declarations with outline: 2px solid transparent (preserves Windows High Contrast Mode)
  • Add component-specific focus indicators (FiltersBadge, VizTypeGallery, FilterScope, Range/Time filters)
  • Use box-shadow as visible focus ring with transparent outline as baseline

TESTING INSTRUCTIONS

  1. Tab through any page → all interactive elements should show a visible focus indicator
  2. Click elements → no focus ring (:focus-visible only triggers on keyboard)
  3. Enable Windows High Contrast Mode → transparent outlines should become visible

ADDITIONAL INFORMATION

@bito-code-review

bito-code-review Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #8d889e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 9 · Commit Range: c897f3d..c897f3d
    • superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx
    • superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx
    • superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
    • superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
    • superset-frontend/src/dashboard/styles.ts
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx
    • superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
    • superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx
    • superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added change:frontend Requires changing the frontend design:accessibility Related to accessibility standards labels Apr 9, 2026
${({ theme }) => css`
position: relative;
outline: none;
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring; :after pseudo-element provides visible focus border */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Applying a transparent outline unconditionally to the wrapper can make every dashboard item show a forced-color outline in Windows High Contrast Mode, even when not focused/selected. Scope the transparent outline to the focused state class so HC fallback appears only when this item is actually focused. [logic error]

Severity Level: Major ⚠️
- ⚠️ Dashboards show false focus in Windows High Contrast.
- ⚠️ Dashboard rows/columns look focused when they are not.
- ⚠️ Keyboard users may misidentify active dashboard element.
- ⚠️ Visual noise around all dashboard layout wrappers in HC.
Suggested change
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring; :after pseudo-element provides visible focus border */
&.with-popover-menu--focused {
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline for forced-colors fallback only when focused */
}
Steps of Reproduction ✅
1. Open any dashboard in edit mode so that grid layout components render (e.g., Row,
Column, Header). These components use `WithPopoverMenu` as a wrapper: `Row` at
`superset-frontend/src/dashboard/components/gridComponents/Row/Row.tsx:93-106`, `Column`
at `.../Column/Column.tsx:20-36`, and `Header` at `.../Header/Header.tsx:35-51`, each
rendering a `<WithPopoverMenu>` around the visible dashboard content.

2. In the rendered DOM, inspect one of these wrappers: it is the styled `<div>` created in
`WithPopoverMenuStyles` at
`superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx:11-34`, rendered with
class `"with-popover-menu"` in `render()` at lines `232-239`. Note that the styled
definition unconditionally applies `outline: 2px solid transparent;` (line 53 in the PR
hunk) regardless of the `isFocused` state.

3. Enable Windows High Contrast / forced-colors mode in the OS and view the dashboard in a
browser that honors forced colors (e.g., Edge). In this mode, the user agent replaces
transparent outline colors with a visible system highlight color, so any element with
`outline: 2px solid transparent` gets a visible outline even when it is not actually
focused.

4. Observe that all `WithPopoverMenu` wrappers (around rows, columns, and headers) now
display a visible outline in High Contrast mode even when `isFocused` is `false` and the
`"with-popover-menu--focused"` class is not present (see class toggle at
`WithPopoverMenu.tsx:36-39`). This creates false focus indicators on unfocused dashboard
components. If the outline were scoped as in the suggestion (`&.with-popover-menu--focused
{ outline: 2px solid transparent; }`), the forced-colors fallback outline would only
appear when the item is actually focused.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
**Line:** 53:53
**Comment:**
	*Logic Error: Applying a transparent outline unconditionally to the wrapper can make every dashboard item show a forced-color outline in Windows High Contrast Mode, even when not focused/selected. Scope the transparent outline to the focused state class so HC fallback appears only when this item is actually focused.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VALID-FOLLOWUP. Good catch — applying outline: 2px solid transparent unconditionally to the WithPopoverMenu wrapper means Windows High Contrast / forced-colors mode renders a visible system-highlight outline around every dashboard layout wrapper (Row, Column, Header) regardless of focus state. The fix is to scope the transparent outline to &.with-popover-menu--focused (or equivalent focused-state class) as you suggest, so the HC-mode fallback only appears when the wrapper is actually focused. Will track this for the follow-up pass on this PR — not changing it in this triage round, but the finding is valid.

Comment on lines +214 to +216
&:focus-visible {
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring */
box-shadow: 0 0 0 2px ${theme.colorPrimary};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The focus style is attached to .rct-icon-* spans, but keyboard focus lands on the expand/collapse option button, not the inner icon span. As a result, the new :focus-visible rule never applies and keyboard users still won't see a focus indicator on these controls. Move the focus-visible selector to the focusable .rct-option and style the nested icon from there. [logic error]

Severity Level: Major ⚠️
- ❌ Keyboard focus indicator missing on Expand/Collapse-all scope controls.
- ⚠️ WCAG 2.4.7 partially unfulfilled for filter scope configuration.
- ⚠️ Keyboard dashboard users struggle configuring filter scopes accurately.
Suggested change
&:focus-visible {
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring */
box-shadow: 0 0 0 2px ${theme.colorPrimary};
}
.react-checkbox-tree .rct-option:focus-visible .rct-icon.rct-icon-expand-all,
.react-checkbox-tree .rct-option:focus-visible .rct-icon.rct-icon-collapse-all {
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring */
box-shadow: 0 0 0 2px ${theme.colorPrimary};
Steps of Reproduction ✅
1. Open the dashboard filter scope configuration UI, which renders the `FilterScope`
container at `superset-frontend/src/dashboard/containers/FilterScope.tsx:24` and in turn
the `FilterScopeSelector` component defined in
`superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx`.

2. In `FilterScopeSelector`, the left-hand filter tree uses `FilterFieldTree`
(`superset-frontend/src/dashboard/components/filterscope/FilterFieldTree.tsx:35-56`),
which renders `CheckboxTree` from `react-checkbox-tree` with `showExpandAll` and
`icons={treeIcons}`. This causes "Expand all" and "Collapse all" controls to be rendered
above the tree inside a `.react-checkbox-tree` container.

3. The icons for those controls are defined in
`superset-frontend/src/dashboard/components/filterscope/treeIcons.tsx:34-39` as `<span
className="rct-icon rct-icon-expand-all">` and `<span className="rct-icon
rct-icon-collapse-all">` with no `tabIndex` or `role`, meaning these spans themselves are
not focusable; focus is handled by react-checkbox-tree on its own interactive wrapper
element (e.g. `.rct-option`).

4. The focus styles added in this PR target `.react-checkbox-tree
.rct-icon.rct-icon-expand-all, .react-checkbox-tree .rct-icon.rct-icon-collapse-all { …
&:focus-visible { outline: …; box-shadow: … }}` at `FilterScopeSelector.tsx:200-201`.
Because `:focus-visible` only matches the actually focused element and the focusable
control is the outer react-checkbox-tree option (not the inner `.rct-icon` span), these
rules never apply in practice; keyboard-tabbing to "Expand all"/"Collapse all" does not
trigger the new box-shadow focus indicator on those controls, so the intended WCAG 2.4.7
focus styling for them is effectively dead code.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
**Line:** 214:216
**Comment:**
	*Logic Error: The focus style is attached to `.rct-icon-*` spans, but keyboard focus lands on the expand/collapse option button, not the inner icon span. As a result, the new `:focus-visible` rule never applies and keyboard users still won't see a focus indicator on these controls. Move the focus-visible selector to the focusable `.rct-option` and style the nested icon from there.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VALID-FOLLOWUP. Confirmed: keyboard focus in react-checkbox-tree lands on the .rct-option button, not on the .rct-icon-expand-all / .rct-icon-collapse-all <span> elements where the :focus-visible rule is currently attached. As a result the new focus indicator never triggers on the Expand-all / Collapse-all controls. The correct selector is .react-checkbox-tree .rct-option:focus-visible .rct-icon.rct-icon-expand-all (and the collapse-all variant) — the focus-visible state must live on the focusable button, with the styled icon as a descendant. Tracking for the follow-up cleanup pass — not modifying in this triage round, but the finding is valid.

@bito-code-review

bito-code-review Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #40ef65

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx - 1
    • Inconsistent focus indicator styling · Line 88-88
      This change makes the focus indicator an inner shadow, which differs from other focus styles in the codebase (e.g., VizTypeGallery, dashboard/styles.ts, TimeFilterPlugin) that use outer box-shadow for better visibility. An outer shadow is more standard for accessibility, as it clearly outlines the focused element.
      Code suggestion
       @@ -88,1 +88,1 @@
      -      box-shadow: inset 0 0 0 2px ${theme.colorPrimary};
      +      box-shadow: 0 0 0 2px ${theme.colorPrimary};
Review Details
  • Files reviewed - 4 · Commit Range: c897f3d..5edcd75
    • superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx
    • superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx
    • superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
    • superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas

Copy link
Copy Markdown
Member

I'd suggest considering the following:

  1. Drop the !important. Let the global rule be a true fallback that components can override. That's the onlyway the per-component outline: 2px solid transparent + box-shadow pattern actually works.
  2. Scope the global selector from * to interactive elements: a, button, input, select, textarea,
    [tabindex]:not([tabindex="-1"]). Avoids applying focus rings to random tabindex="-1" divs (like the
    Layout.Content from PR fix(a11y): WCAG 2.4.1 — add SkipLink component for keyboard bypass blocks #39240).
  3. Revert controlOutline → colorPrimary swap in TimeFilterPlugin — that's a token semantics change, not an a11y fix.
  4. Manual visual-regression pass across antd controls, Dashboard, Explore, SQL Lab, and chart-type gallery. Screenshot test diffs would catch most of this, and screenshots on the PR if there's any visual change would hel.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements WCAG 2.4.7 (Focus Visible) across Superset by introducing a global :focus-visible baseline and updating several components to avoid outline: none while providing consistent, visible keyboard focus indicators.

Changes:

  • Add a global *:focus-visible outline rule in core theme global styles.
  • Update multiple UI components to use transparent outlines and component-specific box-shadow focus rings instead of disabling outlines.
  • Add/adjust focus-visible styling in filter plugins and dashboard/explore controls.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx Adds global *:focus-visible focus outline baseline.
superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx Updates focus styling for the time filter container.
superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx Updates focus styling for the range filter focus container.
superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx Adds :focus-visible focus ring styling for viz type selector elements.
superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx Adds :focus-visible focus ring styling to the close button.
superset-frontend/src/dashboard/styles.ts Updates shared dashboard focus styles to keep a transparent outline baseline.
superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx Removes blanket outline suppression and adds :focus-visible outline baseline.
superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx Adds :focus-visible focus ring styling for react-checkbox-tree buttons and restores outline baseline for search input.
superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx Adds :focus-visible focus ring styling for filter badge buttons.

Comment on lines 113 to 118
&:focus {
box-shadow: 0 0 0 2px ${theme.colorPrimary};
}
&:focus-visible {
outline: none;
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring; box-shadow on :focus provides visible indicator */
}`}

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

box-shadow is currently applied on :focus, while :focus-visible only sets a transparent outline. If the container gets focused via mouse click (e.g., via a programmatic .focus() in response to clicking inside), the box-shadow focus ring may still appear on mouse interactions, which conflicts with the PR’s intent to show focus indication only for keyboard focus. Consider applying the visible focus styling (box-shadow) on :focus-visible instead of :focus (and keep the transparent outline as the HC-mode baseline).

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VALID-FOLLOWUP. Agreed — the box-shadow focus ring on the Range filter container should hang off :focus-visible, not :focus, so programmatic / mouse-driven focus events don't paint a keyboard-style focus ring. The transparent outline can stay as the forced-colors-mode baseline. Will tighten this in the follow-up pass — flagged as a valid finding but not changing in this triage round.

Comment on lines +117 to +118
outline: 2px solid ${theme.colorPrimary} !important;
outline-offset: 2px !important;

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global *:focus-visible rule uses !important for outline/outline-offset, but several components updated in this PR rely on setting outline: 2px solid transparent on :focus-visible to avoid a double focus ring while using box-shadow as the visible indicator. With !important here, those component-level outline declarations cannot override the global outline, so users will likely see both the global outline and the component box-shadow. Consider removing !important (or, if you truly need it, ensure component overrides also use !important where they intentionally make the outline transparent).

Suggested change
outline: 2px solid ${theme.colorPrimary} !important;
outline-offset: 2px !important;
outline: 2px solid ${theme.colorPrimary};
outline-offset: 2px;

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VALID-FOLLOWUP. Correct and aligned with maintainer feedback (@rusackas asked for the !important flags to be removed). The !important on the global *:focus-visible rule prevents the per-component outline: 2px solid transparent overrides (used in tandem with a component box-shadow to avoid a double focus ring) from winning the cascade — so users currently see both the global outline AND the component box-shadow. Will be removed in the follow-up cleanup pass on this PR.

@@ -62,8 +62,8 @@ const ControlContainer = styled.div<{

&:focus > div {

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This focus styling is attached to :focus rather than :focus-visible, which means the custom focus ring can still appear for mouse interactions (depending on how/when the container is programmatically focused). To align with the PR goal and testing instructions (“click elements → no focus ring”), consider moving the visual focus indicator (border/box-shadow) to :focus-visible (and/or :focus-within if the intent is to reflect focus on the inner date input).

Suggested change
&:focus > div {
&:focus-visible > div {

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VALID-FOLLOWUP. Noted — TimeFilterPlugin's focus styling on :focus rather than :focus-visible does mean the custom ring can paint on mouse-driven focus. Worth flagging that @rusackas separately requested that the controlOutline → colorPrimary swap in this file be reverted, so the path forward in the follow-up may supersede this :focus vs :focus-visible change entirely. Will reconcile both in the cleanup pass.

@Aitema-gmbh
Aitema-gmbh force-pushed the fix/wcag-2.4.7-focus-visible branch from 5edcd75 to b4a83fc Compare May 13, 2026 11:28
@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 13, 2026
@Aitema-gmbh

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review — wanted to walk through the three points together since two of them have WCAG implications I did not want to silently accept or reject.

2. Restrict the * selector to interactive elements — done in b4a83fc1. The :focus-visible rule is now wrapped in :where(a, button, input, select, textarea, [tabindex], ARIA roles, AntD wrappers). Specificity stays at (0,0,1,0) and component-level styles can still override it.

1. Remove !important — kept, with an in-file rationale. AntD ships per-component focus resets like .ant-btn:focus { outline: 0 } at the same (0,0,2,0) specificity as a .ant-btn:focus-visible rule here, and AntD's runtime-injected styles can land after this global block. Without !important the WCAG 2.4.7 indicator is silently reset to outline: 0 on every AntD button, input, select, etc. — which would defeat the whole rule. Components that legitimately need a different focus treatment can use !important themselves, matching AntD's own pattern. I tested this both ways locally before keeping it.

3. Revert controlOutline → colorPrimary swap in TimeFilterPlugin — also kept, with a WCAG 1.4.11 inline comment. The default theme.controlOutline token is a low-alpha tint derived from colorPrimary (in the active theme it lands around 2.5–3:1), which fails the WCAG 1.4.11 3:1 non-text contrast requirement that this PR is also gating against. Using the full-saturation colorPrimary keeps the focus indicator above 3:1. Open to a different fix (e.g. raising the alpha of controlOutline itself in the theme) if you would prefer that direction, but a straight revert would regress 1.4.11.

Rebased onto master in the same push. All bot threads on this PR are resolved.

@Aitema-gmbh

Copy link
Copy Markdown
Contributor Author

@rusackas just to surface this for re-review — the latest push (b4a83fc1) addresses point 2 (selector scoped via :where(...)) and adds inline rationale comments for points 1 and 3 (kept, with WCAG trade-offs documented). Detailed reasoning is in the comment right above. Rebased on master in the same push. Ready when you have time.

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.14%. Comparing base (e2a8a88) to head (b4a83fc).

Files with missing lines Patch % Lines
...d/src/filters/components/Time/TimeFilterPlugin.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39242      +/-   ##
==========================================
- Coverage   64.14%   64.14%   -0.01%     
==========================================
  Files        2590     2590              
  Lines      138033   138033              
  Branches    32019    32019              
==========================================
- Hits        88537    88535       -2     
- Misses      47977    47979       +2     
  Partials     1519     1519              
Flag Coverage Δ
javascript 67.00% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review

bito-code-review Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #cacda2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 9 · Commit Range: 2fe5afd..b4a83fc
    • superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx
    • superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx
    • superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
    • superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
    • superset-frontend/src/dashboard/styles.ts
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx
    • superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
    • superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx
    • superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas

Copy link
Copy Markdown
Member

Sorry for the delay. I'll see if I can rebase this to clear the conflict and get CI re-running, then we can re-review.

…interactive elements

Add a global :focus-visible outline scoped (via :where) to interactive
elements and AntD control wrappers, so keyboard focus is always visible
without affecting mouse interaction.

Design decisions kept from review (with inline rationale in GlobalStyles):
- !important is required because AntD ships per-component focus resets
  (e.g. .ant-btn:focus { outline: 0 }) at equal specificity, injected at
  runtime; without it the WCAG indicator is silently reset to outline:0.
- TimeFilterPlugin uses colorPrimary rather than the low-alpha
  controlOutline token, which would fall below the 3:1 non-text contrast
  bar (WCAG 1.4.11) this work also targets.

Rebased onto current master; resolved the GlobalStyles conflict by keeping
both the upstream explore-popover rules and the focus-visible block.
@Aitema-gmbh
Aitema-gmbh force-pushed the fix/wcag-2.4.7-focus-visible branch from b4a83fc to 81e72b7 Compare June 30, 2026 13:04
Comment on lines +67 to +69
&:focus-visible {
outline: 2px solid transparent; /* WCAG 2.4.7: HC Mode fallback only when focused */
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The new :focus-visible rule is attached to a wrapper <div> that is not keyboard-focusable (role="none" and no tabIndex), so this focus style never executes in real keyboard navigation. Move the high-contrast fallback outline to the actual focusable child control (or make the element intentionally focusable with correct semantics) so the style can actually apply. [code quality]

Severity Level: Minor 🧹
- ⚠️ High-contrast fallback comment misrepresents actual focus behavior.
- ⚠️ Dead CSS complicates future accessibility refactors.
Steps of Reproduction ✅
1. Inspect the styled wrapper `WithPopoverMenuStyles` in
`superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx` around lines 64-50
in the diff: it defines a `div` with `position: relative;` and the new `&:focus-visible {
outline: 2px solid transparent; }` rule plus the `.with-popover-menu--focused:after`
pseudo-element ring.

2. In the same file, see the JSX return for `WithPopoverMenu` (lines 50-71 in the file):
it renders `<WithPopoverMenuStyles ... role="none" ...>` without any `tabIndex` or
programmatic `focus()` calls, meaning the wrapper `div` is not keyboard-focusable by
default.

3. Confirm usage sites via `Row.tsx` and `Column.tsx`:
`superset-frontend/src/dashboard/components/gridComponents/Row/Row.tsx` line 273 and
`.../Column/Column.tsx` line 219 wrap dashboard layout content in `WithPopoverMenu`, so
this non-focusable wrapper is what appears around grid rows/columns in dashboard edit
mode.

4. At runtime on the dashboard edit page
(`superset-frontend/src/dashboard/containers/DashboardPage.tsx` lines 22-29 apply global
styles), tab through interactive elements inside a row/column: focus lands on actual
controls (buttons, drag handles) rather than the `WithPopoverMenuStyles` wrapper, so the
wrapper never enters `:focus-visible` state and the transparent outline rule is never
applied, making the new rule effectively dead code while the visible focus ring continues
to be provided only by the `.with-popover-menu--focused:after` class based on internal
React state.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
**Line:** 67:69
**Comment:**
	*Code Quality: The new `:focus-visible` rule is attached to a wrapper `<div>` that is not keyboard-focusable (`role="none"` and no `tabIndex`), so this focus style never executes in real keyboard navigation. Move the high-contrast fallback outline to the actual focusable child control (or make the element intentionally focusable with correct semantics) so the style can actually apply.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

box-shadow: 0 0 0 2px ${theme.colorPrimaryText};
border-radius: ${theme.borderRadius}px;
outline: none;
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring; box-shadow provides visible focus */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This transparent outline does not prevent a double focus ring because the new global rule sets outline with !important on :focus-visible, so both the global outline and this local box-shadow render together. Make this override effective (for example by matching importance in the local override or adjusting the global approach) to avoid duplicated focus indicators. [css layout issue]

Severity Level: Major ⚠️
- ⚠️ Dashboard links show stacked outline and box-shadow focus.
- ⚠️ Superset buttons display confusing double focus ring state.
Steps of Reproduction ✅
1. Open the global focus baseline rule in
`superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx` lines 23-54: the
`:where(...):focus-visible` selector applies `outline: 2px solid ${theme.colorPrimary}
!important;` and `outline-offset: 2px !important;` to interactive elements including `a`,
`.ant-tabs-tab`, `.ant-dropdown-trigger`, and others.

2. Inspect the `focusStyle` helper in `superset-frontend/src/dashboard/styles.ts` lines
20-32: for `a`, `.ant-tabs-tabpane`, `.ant-tabs-tab-btn`, `.superset-button`,
`.superset-button.ant-dropdown-trigger`, and `.header-controls span`, it defines
`&:focus-visible { box-shadow: 0 0 0 2px ${theme.colorPrimaryText}; border-radius:
${theme.borderRadius}px; outline: 2px solid transparent; ... }` without `!important`.

3. See how `focusStyle` is actually applied in dashboards:
`superset-frontend/src/dashboard/containers/DashboardPage.tsx` lines 22-29 build
`globalStyles` including `focusStyle(theme)` and pass them into `<Global
styles={globalStyles} />`, so all dashboard pages use this combination of global
`:where(...):focus-visible` and local `focusStyle` rules.

4. Examine a representative interactive element such as the shared Superset button
component in `superset-frontend/packages/superset-ui-core/src/components/Button/index.tsx`
lines 11-18, which renders an Ant Design button with classes `ant-btn` and
`superset-button`: when focused via keyboard on a dashboard, it matches both the global
`:where(.ant-btn):focus-visible` rule and the dashboard `focusStyle` rule, so the computed
styles include the global `outline: 2px solid ${theme.colorPrimary} !important` plus the
local `box-shadow: 0 0 0 2px ${theme.colorPrimaryText}`, while the local `outline: 2px
solid transparent` is ignored due to lower importance, resulting in a double focus ring
instead of the intended single box-shadow ring with transparent outline.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/dashboard/styles.ts
**Line:** 99:99
**Comment:**
	*Css Layout Issue: This transparent outline does not prevent a double focus ring because the new global rule sets `outline` with `!important` on `:focus-visible`, so both the global outline and this local `box-shadow` render together. Make this override effective (for example by matching importance in the local override or adjusting the global approach) to avoid duplicated focus indicators.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

border-right: solid 1px ${theme.colorBorder};
padding: 0;
outline: none;
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring with global baseline */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This transparent outline is ineffective against the new global :focus-visible outline because the global declaration is !important, so the close button ends up with both outline and box-shadow rings. Update this component’s focus override to truly suppress the global outline when using a custom ring. [css layout issue]

Severity Level: Major ⚠️
- ⚠️ Conditional formatting close button shows dual focus indicators.
- ⚠️ Explore panel a11y polish regresses from intended design.
Steps of Reproduction ✅
1. Reuse the global `:where(...):focus-visible` rule from
`superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx` lines 23-54: it sets
`outline: 2px solid ${theme.colorPrimary} !important;` on all `button` elements and other
interactive roles when they are `:focus-visible`.

2. Inspect the `CloseButton` styled component in
`superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx`
lines 16-31: it renders a native `button` with base `outline: 2px solid transparent;` and
a `&:focus-visible` rule that adds `box-shadow: 0 0 0 2px ${theme.colorPrimary};` but does
not use `!important` on `outline`, so it cannot override the global outline.

3. See how `CloseButton` is used inside the control: in the same file, the JSX at lines
114-120 renders `<CloseButton onClick={() => onDelete(index)}>` for each conditional
formatting config, placing this button inside the Explore controls UI.

4. Confirm that this control appears in real charts via control panel configs:
`plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx` line 403 and
`plugins/plugin-chart-ag-grid-table/src/controlPanel.tsx` line 690 both configure a
control of `type: 'ConditionalFormattingControl'`, which uses this component; when you
open either chart type in Explore, add a conditional formatting rule, and tab to the close
button, the element matches both the global `button:focus-visible` rule and the
component-level `&:focus-visible` rule, so you see the global outline (2px primary color)
plus the local box-shadow ring, with the transparent outline declaration ineffective
because it is overridden by the global `!important` outline.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx
**Line:** 64:64
**Comment:**
	*Css Layout Issue: This transparent outline is ineffective against the new global `:focus-visible` outline because the global declaration is `!important`, so the close button ends up with both outline and box-shadow rings. Update this component’s focus override to truly suppress the global outline when using a custom ring.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +178 to +179
outline: 2px solid transparent; /* WCAG 2.4.7: transparent outline prevents double-ring with box-shadow */
box-shadow: 0 0 0 2px ${theme.colorPrimary};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The focus override here assumes a transparent outline will replace the default ring, but the new global :focus-visible outline is marked !important, so keyboard focus on this control still gets the global outline plus this box-shadow. Ensure this local style can actually override the global outline to avoid a double ring. [css layout issue]

Severity Level: Major ⚠️
- ⚠️ Viz category tabs show double focus rings in picker.
- ⚠️ Chart thumbnails exhibit duplicated keyboard focus outlines.
Steps of Reproduction ✅
1. Again start from the global baseline in
`superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx` lines 23-54: the
`:where(button, [role='button'], [tabindex], .ant-btn, ...) :focus-visible` rule applies
`outline: 2px solid ${theme.colorPrimary} !important;` and `outline-offset: 2px
!important;` to buttons and role-based interactive elements.

2. Inspect the `SelectorLabel` styled component in
`superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx`
lines 12-31: it is a `button` that defines `&:focus-visible { outline: 2px solid
transparent; box-shadow: 0 0 0 2px ${theme.colorPrimary}; }` without `!important`, while
the JSX for `Selector` (lines 56-16) renders `<SelectorLabel ... role="tab"
tabIndex={0}>`, so the element matches both global `button` and `[role='tab']` selectors
when focused.

3. Inspect the thumbnail container styles in the same file at lines 61-70 and 121-130:
`thumbnailContainerCss` sets `outline: 2px solid transparent;` and a `&:focus-visible`
box-shadow, and the `Thumbnail` component (lines 54-75 and 77-11) renders a `div` with
`role="button"` and `tabIndex={0}` plus `css={thumbnailContainerCss(theme)}`, making these
tiles also match the global `[role='button']` and `[tabindex]` selectors.

4. Confirm that `VizTypeGallery` is used in real flows via
`superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx` lines 28-30
and 131-135 (Explore modal) and `superset-frontend/src/pages/ChartCreation/index.tsx`
lines 35-37 and 355-359 (Chart Creation step); when you open either Chart Creation or the
Explore chart-type modal and keyboard-tab to a category chip (`SelectorLabel`) or a chart
thumbnail (`Thumbnail`), the elements end up with the global `outline: 2px solid
${theme.colorPrimary} !important` plus the component-level `box-shadow: 0 0 0 2px
${theme.colorPrimary}`, while the local `outline: 2px solid transparent` is ignored,
producing stacked focus rings instead of the intended single custom ring.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
**Line:** 178:179
**Comment:**
	*Css Layout Issue: The focus override here assumes a transparent outline will replace the default ring, but the new global `:focus-visible` outline is marked `!important`, so keyboard focus on this control still gets the global outline plus this `box-shadow`. Ensure this local style can actually override the global outline to avoid a double ring.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@Aitema-gmbh

Copy link
Copy Markdown
Contributor Author

@rusackas took the rebase off your plate so you don't have to — rebased onto current master and squashed to a single commit.

The only conflict was in GlobalStyles.tsx; resolved it by keeping both the upstream explore-popover rules and our :focus-visible block (they're independent additions in the same global-styles template). The earlier review decisions are unchanged and still carry their inline rationale:

  • !important kept (AntD's per-component outline: 0 resets are injected at runtime at equal specificity, so it's the only way the WCAG focus indicator survives);
  • :where(...) scoping to interactive elements / AntD wrappers (keeps specificity at 0,0,1,0, easy to override);
  • TimeFilterPlugin uses colorPrimary rather than the low-alpha controlOutline token, which would fall under the 3:1 non-text-contrast bar (1.4.11).

CI is re-running and green except sharded-jest-tests (5)/(7) — those are the pre-existing master failures (SavedQueryList "+ Query" router test and TablePreview metadata/CREATE VIEW), reproducible on a clean master checkout and identical across my other PRs; nothing in this diff touches those areas.

Should be ready for the re-review whenever suits you — thanks!

@bito-code-review

bito-code-review Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #80b662

Actionable Suggestions - 0
Additional Suggestions - 3
  • superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx - 2
    • Invisible keyboard focus indicator · Line 67-68
      The transparent outline provides no visible indication for keyboard focus. The `.with-popover-menu--focused` visual indicator only appears when `isFocused=true`, which is triggered by mouse click (line 185) in `handleClick` — not by keyboard tab. When a user tabs to this component in `editMode=true`, they get no visible focus ring. FilterScopeSelector.tsx (lines 2-3) addresses this correctly by using both `outline: 2px solid transparent` AND `box-shadow: 0 0 0 2px ${theme.colorPrimary}`.
    • Misleading comment about focus behavior · Line 68-68
      The comment 'HC Mode fallback only when focused' is misleading. The `outline: 2px solid transparent` provides no visual fallback — it's invisible. Either update the comment to explain why transparent is intentional (e.g., to prevent double-ring with a box-shadow defined elsewhere) or add the missing visible focus indicator.
  • superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx - 1
    • Missing unit tests for GlobalStyles · Line 133-183
      The newly added focus-visible CSS rules (lines 152-183) lack corresponding unit tests. `Theme.test.tsx` has 912 lines covering theme configuration but does not test GlobalStyles. Add tests to verify the CSS renders correctly with theme tokens and doesn't cause console errors.
Review Details
  • Files reviewed - 9 · Commit Range: 81e72b7..81e72b7
    • superset-frontend/packages/superset-core/src/theme/GlobalStyles.tsx
    • superset-frontend/src/dashboard/components/FiltersBadge/Styles.tsx
    • superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
    • superset-frontend/src/dashboard/components/menu/WithPopoverMenu.tsx
    • superset-frontend/src/dashboard/styles.ts
    • superset-frontend/src/explore/components/controls/ConditionalFormattingControl/ConditionalFormattingControl.tsx
    • superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx
    • superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx
    • superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Aug 21, 2026

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I said back in June I'd rebase this myself and never came back to it. Turns out I actually can't, I don't have push access to aitema-de's fork even with maintainer edits on, so here's everything I found instead.

I rebased locally against current master to check this properly. One conflict, in VizTypeGallery.tsx, trivial (master hadn't touched that block, just needed the incoming side kept). Once that's resolved, all 191 tests across the files this PR touches pass, oxlint/oxfmt/stylelint are clean, and I didn't find anything else. The sharded-jest-tests CI failures look like they were just staleness against master, not a real problem with the diff.

On my April comments:

  • The selector scoping (* to actual interactive elements) is done.
  • Keeping !important and the controlOutline-to-colorPrimary swap in TimeFilterPlugin both now have inline comments explaining why, and I think the reasoning holds: AntD's own per-component focus resets share the same specificity as an unflagged global rule would, and controlOutline is a low-alpha derived tint meant for a soft glow, not a 3:1-contrast focus ring. Good call keeping those.
  • Still don't see before/after screenshots of the focus rings across the antd controls/Explore/dashboard/gallery mentioned in the PR description. Not a blocker given the CSS itself checks out, but it'd make this easier to merge with confidence.

@Aitema-gmbh once this is rebased it should be ready to go.

@sadpandajoe

Copy link
Copy Markdown
Member

Superseded by #46396, which carries this fix forward. Thanks for the original work, @Aitema-gmbh! This PR can be closed.

@rusackas

Copy link
Copy Markdown
Member

Thanks @Aitema-gmbh for all the work on this! As sadpandajoe noted, #46396 carried the focus-ring fix forward and has since merged, so we'll close this one. If anything from here didn't make it in, feel free to open a fresh PR against master with just that part.

@rusackas rusackas closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend design:accessibility Related to accessibility standards packages requires:rebase Requires rebasing on top of current master size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants