Skip to content

Fix accessibility: heading hierarchy and color contrast issues#8372

Open
deadlock1997 wants to merge 1 commit intoreactjs:mainfrom
deadlock1997:fix/accessibility-contrast-heading
Open

Fix accessibility: heading hierarchy and color contrast issues#8372
deadlock1997 wants to merge 1 commit intoreactjs:mainfrom
deadlock1997:fix/accessibility-contrast-heading

Conversation

@deadlock1997
Copy link

Summary

Fixes 5 accessibility violations on the homepage detected by axe DevTools (issue #8369).

Heading hierarchy fixes (HomeContent.js)

  • h4h3 for "Stay true to the web" — was skipping from h2 to h4
  • h4h3 for "Go truly native" — same skip
  • h1h2 for "React Videos" inside demo panel — page had two h1 elements

Color contrast fixes

  • TopNav.tsx search button: text-gray-30text-gray-50 dark:text-gray-30
  • HomeContent.js BrowserChrome address bar: text-gray-30text-gray-50 dark:text-gray-30

Both were rendering #99A1B3 on ~#EBEDEF in light mode — only 2.2:1 contrast. The fix brings it to ~4.84:1, meeting WCAG 2 AA (4.5:1 minimum). Dark mode is unchanged as it already passed.

Screeshots

Screenshot 2026-03-23 at 12 59 18 AM

Closes #8369

@github-actions
Copy link

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.02 KB (🟡 +4 B) 242.16 KB
/500 127.03 KB (🟡 +4 B) 242.17 KB
/[[...markdownPath]] 129.46 KB (🟡 +4 B) 244.6 KB
/errors 127.27 KB (🟡 +4 B) 242.41 KB
/errors/[errorCode] 127.25 KB (🟡 +4 B) 242.38 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@Assamee
Copy link

Assamee commented Mar 22, 2026

Hi @deadlock1997, great work with the PR! The heading tag fixes look spot on and using text-gray-50 for the light mode perfectly fixes the contrast issues.

I was actually just running a manual accessibility check on Issue #8369 locally using Axe DevTools, and I wanted to flag a tiny edge case for the dark mode.

I noticed you added dark:text-gray-30 to keep the original colour for the dark mode. My local checks actually caught a small failure for that exact variable. The foreground gray-30 (#99A1B3) against the dark background (#343945) results in a 4.45:1 ratio, which narrowly misses the WCAG AA minimum contrast ratio requirements (4.5:1).

To fully clear the automated warnings, we probably need to bump the dark mode class up one shade (e.g. using dark:text-gray-20 instead of 30)

If you update the commit, I'm happy to test it locally :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility: Color Contrast and Heading level Issues

2 participants