Skip to content

fix(a11y): WCAG 2.4.6 — add descriptive headings and section labels - #39241

Closed
Aitema-gmbh wants to merge 3 commits into
apache:masterfrom
aitema-de:fix/wcag-2.4.6-headings-labels
Closed

Aitema-gmbh wants to merge 3 commits into
apache:masterfrom
aitema-de:fix/wcag-2.4.6-headings-labels

Conversation

@Aitema-gmbh

Copy link
Copy Markdown
Contributor

SUMMARY

Implements WCAG 2.1 criterion 2.4.6 (Headings and Labels, Level AA).

  • Add screen-reader-only <h1> headings to all main pages (Home, Dashboards, Charts, SQL Lab, Datasets, Chart Creation)
  • Add <h2> section headings for Dashboard content areas and filter panels
  • Render chart titles as semantic <h2> elements
  • Use sr-only CSS pattern to maintain visual design

TESTING INSTRUCTIONS

  1. Install HeadingsMap browser extension
  2. Navigate through main pages → each should have an h1
  3. Open a Dashboard → chart sections should have h2 headings
  4. Screen reader should announce page structure correctly

ADDITIONAL INFORMATION

- Add visually-hidden h1 with dashboard name to Dashboard Header
- Add visually-hidden h1 with chart name to Explore/Chart Header
- Add visually-hidden h1 to Home page and ChartCreation page
- Fix ChartCreation heading hierarchy (h3 → h2)
- Add sr-only h2 section headings for Filters and Dashboard Content areas
- All headings use clip/sr-only pattern for screen readers only

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bito-code-review

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #effbd8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: 14d7b43..14d7b43
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx
    • superset-frontend/src/dashboard/components/Header/index.tsx
    • superset-frontend/src/explore/components/ExploreChartHeader/index.tsx
    • superset-frontend/src/pages/ChartCreation/index.tsx
    • superset-frontend/src/pages/Home/index.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

@dosubot dosubot Bot added change:frontend Requires changing the frontend design:accessibility Related to accessibility standards labels Apr 9, 2026
@bito-code-review

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #df80d9

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 14d7b43..179d7b0
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.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

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

Implements WCAG 2.4.6 (Headings and Labels) improvements in Superset’s main UI surfaces by introducing semantic (mostly screen-reader-only) page/section headings to improve navigability for assistive technologies.

Changes:

  • Add screen-reader-only <h1> headings to key pages (Home, Explore, Dashboard, Chart Creation).
  • Add screen-reader-only <h2> section headings for Dashboard areas (Filters, Dashboard content).
  • Adjust Chart Creation heading markup to support the new heading structure.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
superset-frontend/src/pages/Home/index.tsx Adds SR-only <h1> “Home” heading.
superset-frontend/src/pages/ChartCreation/index.tsx Adds SR-only <h1> and introduces a visible heading element for the page title.
superset-frontend/src/explore/components/ExploreChartHeader/index.tsx Adds SR-only <h1> derived from slice name / fallback label.
superset-frontend/src/dashboard/components/Header/index.tsx Adds SR-only <h1> for the dashboard title.
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx Adds SR-only <h2> headings for Filters and Dashboard content areas.

@rusackas

rusackas commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

Bugs/concerns:

  1. Duplicate "Filters" h2 in the vertical filter bar path. Look at the vertical case: the PR adds Filters outside ResizableSidebar, and also inside renderChild (line 583 before the ) — which itself is rendered inside that same ResizableSidebar. Result: screen readers will announce "Filters, heading level 2" twice in a row when the vertical filter bar is visible. One or the other should be removed.
  2. DRY / code smell. The identical SrOnlyH1 / SrOnlyH2 styled block is copy-pasted into 5 files. PR 39240 already creates src/components/Accessibility/ — a shared VisuallyHidden or SrOnly component with a configurable as prop belongs there.
  3. ChartCreation double-renders the title unnecessarily:
    - <SrOnlyH1>{t('Create a new chart')}</SrOnlyH1>
    - <h2 aria-hidden="true">{t('Create a new chart')}</h2>
  4. Two copies of the same text. Cleaner: make the visible heading <h1> and style it to look like the old h3/h2. Also the StyledContainer CSS was updated from h3 → h2, which changes the visual level name — worth verifying no other CSS in the app targets ChartCreation h3.
  5. Indentation. The new fragment wrapper around ResizableSidebar leaves the inner at the pre-wrap indent level. Prettier will likely reformat, but it signals the change wasn't fully linted locally.
  6. No tests added - these would be helpful here.

Aitema-gmbh pushed a commit to aitema-de/superset that referenced this pull request May 7, 2026
…and SkipLink tests

Addresses three review polish points on PR apache#39240:

- Add `<main>` landmark via role="main" on Layout.Content so the skip target
  has semantic meaning beyond just an id anchor.
- Scope `outline: none` to `[tabindex='-1']:focus` on the same element so the
  programmatic-focus moment doesn't render a stray browser outline. The rule
  is intentionally tight: only fires when SkipLink has dynamically attached
  tabindex='-1', does not affect any other element.
- Add `VisuallyHidden` reusable component (with `as` prop for h1, h2, etc.)
  in the Accessibility folder. This is the shared sr-only primitive that
  WCAG 2.4.6 (PR apache#39241) needs to deduplicate across pages.

Tests added for both SkipLink and VisuallyHidden covering default behavior,
custom props, focus management, and tabindex cleanup on blur.
…isuallyHidden

Addresses six review concerns on PR apache#39241:

- Bug: vertical filter bar rendered "Filters" h2 twice (once outside the
  ResizableSidebar wrapper, once inside renderChild before StickyPanel).
  Screen readers announced the heading twice. Removed the outer one and
  kept the inner one — that's the semantically correct location since it
  scopes to the FiltersPanel container.
- DRY: replaced the SrOnlyH1 / SrOnlyH2 styled blocks copy-pasted into
  five files with the shared VisuallyHidden component (with `as` prop).
  Component lives in src/components/Accessibility/ alongside SkipLink.
- ChartCreation no longer renders the title twice (sr-only h1 plus visible
  aria-hidden h2). Now uses a single visible h1 styled to match the previous
  h2 size, with the StyledContainer CSS rule updated from h2 to h1.
- StyledContainer CSS audit: no other selectors target ChartCreation h3
  anywhere in src — the previous h3 → h2 → h1 chain is contained.
- Indentation in DashboardWrapper return cleaned up (no fragment wrapper
  needed after removing the duplicate h2).
- Tests added for VisuallyHidden covering default rendering, custom `as`,
  prop forwarding, and the sr-only style invariant.

This PR depends on apache#39240 introducing the same Accessibility folder; once
that merges first, the duplicate component definition will rebase away.
@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 7, 2026
@netlify

netlify Bot commented May 7, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 2679d1a
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69fcb96bf28fbb0008e2cc7a
😎 Deploy Preview https://deploy-preview-39241--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #ae7f96

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/components/Accessibility/VisuallyHidden.test.tsx - 1
    • Incomplete Test Assertion · Line 50-54
      The test 'applies clip-rect style for screen-reader-only behavior' only checks position: 'absolute', but the name implies verification of the clip-rect technique for visual hiding. Per BITO rule [6262], tests should assert the actual behavior claimed. Add a check for the clip property.
      Code suggestion
       @@ -53,1 +53,2 @@
      -  expect(el).toHaveStyle({ position: 'absolute' });
      +  expect(el).toHaveStyle({ position: 'absolute' });
      +  expect(el).toHaveStyle({ clip: 'rect(0, 0, 0, 0)' });
Review Details
  • Files reviewed - 8 · Commit Range: 179d7b0..2679d1a
    • superset-frontend/src/components/Accessibility/VisuallyHidden.test.tsx
    • superset-frontend/src/components/Accessibility/VisuallyHidden.tsx
    • superset-frontend/src/components/Accessibility/index.tsx
    • superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx
    • superset-frontend/src/dashboard/components/Header/index.tsx
    • superset-frontend/src/explore/components/ExploreChartHeader/index.tsx
    • superset-frontend/src/pages/ChartCreation/index.tsx
    • superset-frontend/src/pages/Home/index.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

@Aitema-gmbh

Copy link
Copy Markdown
Contributor Author

@rusackas all 10 bot threads on this PR are resolved. The two specific concerns you flagged are both addressed in 2679d1a1: duplicate h2 "Filters" in the vertical filter bar — outer copy removed, inner stays inside FiltersPanel; SrOnlyH1 / SrOnlyH2 DRY violation — all five files migrated to the shared VisuallyHidden component from #39240. Ready for re-review.

@rusackas

Copy link
Copy Markdown
Member

Thanks for working through the earlier notes @Aitema-gmbh, the duplicate Filters and the shared VisuallyHidden both look sorted. CI's not green yet though, and it's the diff this time, not just CI/housekeeping.

Chart.test.tsx is failing with "Found multiple elements with the text: ...chart name" - the new sr-only <h1>{sliceName}> in ExploreChartHeader renders the slice name a second time, so the getByText in that test now matches twice. Does an aria-label on the existing header region get us the same a11y win without the duplicate text node?

Also prettier is red on DashboardBuilder.tsx. pre-commit run prettier should clear that.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Aug 1, 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.

I rebased this locally against current master to check where things actually stand (turns out I don't have push access to aitema-de's fork, even with maintainer edits enabled, so I can't push the result myself). The rebase itself is mechanical, 3 small conflicts, all just master having moved past the lines this PR touches.

Good news: everything from the earlier review rounds really is fixed. No duplicate "Filters" heading, the shared VisuallyHidden component is in place everywhere, and ChartCreation is down to one visible <h1> with no aria-hidden duplicate.

What's actually still failing CI, confirmed on the rebased branch: the new sr-only <h1>{sliceName}</h1> in ExploreChartHeader renders the chart name a second time on the page, so the plain getByText(expectedChartName) in Chart.test.tsx's two access-denial tests now matches twice and throws. That's the sharded-jest-tests failure. Fix is just scoping those two assertions:

--- a/superset-frontend/src/pages/Chart/Chart.test.tsx
+++ b/superset-frontend/src/pages/Chart/Chart.test.tsx
@@
-    const { getByTestId, getByText } = render(<ChartPage />, {
+    const { getByTestId, getAllByText } = render(<ChartPage />, {
       useRouter: true,
       useRedux: true,
       useDnd: true,
     });
@@
-    expect(getByText(expectedChartName)).toBeInTheDocument();
+    // The chart name now also renders in a screen-reader-only page heading
+    // (WCAG 2.4.6), so it's expected to appear more than once.
+    expect(getAllByText(expectedChartName).length).toBeGreaterThan(0);
   });

(Same two changes apply to both the is_access_denial test and the "predates is_access_denial" test below it: the destructure and the assertion.) I ran both tests against that diff and they pass.

pre-commit should go green too once this is rebased; I didn't find anything else failing locally.

@Aitema-gmbh, once you rebase onto current master and drop that in, this should be ready for another look.

@sadpandajoe

Copy link
Copy Markdown
Member

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

@sadpandajoe sadpandajoe added the close:superseded Superseded by a newer PR; a maintainer can close label Nov 19, 2026
@Aitema-gmbh

Copy link
Copy Markdown
Contributor Author

Thanks @sadpandajoe for carrying this forward in #46395, and thanks @rusackas for the reviews along the way. Closing in favour of #46395.

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 close:superseded Superseded by a newer PR; a maintainer can close design:accessibility Related to accessibility standards 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