fix(a11y): add skip-to-main-content link for keyboard users - #1115
Merged
Conversation
…ifact
Adds a "Skip to main content" link as the first focusable element on
every page, visually hidden until focused, targeting the existing
shared <main id="main-content"> landmark that every route already
renders into. Gives that landmark tabIndex={-1} plus an explicit
onClick focus call, since relying only on native browser fragment-focus
behavior for a non-interactive element is inconsistent across browsers.
Navbar.jsx on main had a botched merge left in place: two duplicate
`import ... from 'react'` statements (a hard SyntaxError - duplicate
binding) and three overlapping, unclosed <nav> openings stacked
together, one of them using an unimported `Link` component. The file
could not have compiled. Deduplicated down to the single intended nav
structure (NavLink brand with active-route styling, network badge,
hamburger + drawer, focus trap) so the app - and this fix - can
actually build.
Closes zeekman#1052
|
@godekina Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1052.
frontend/src/accessibility.css), targeting the existing shared<main id="main-content">landmark that every route already renders into (AppContentinApp.jsx) - so criterion 2 (a main-content landmark to target) was already satisfied app-wide, no per-page changes needed there.<main>tabIndex={-1}and an explicitonClickon the skip link that calls.focus()on it directly, rather than relying solely on the browser's native "focus the fragment target" behavior - that behavior is inconsistent across browsers for non-natively-focusable elements even withtabindex, so this makes the focus move deterministic.Unrelated but blocking:
frontend/src/components/Navbar.jsxonmainhas a botched merge left in - two duplicateimport ... from 'react'statements (a hard SyntaxError, duplicate binding) and three overlapping/unclosed<nav>openings stacked on top of each other, one of them referencing an unimportedLinkcomponent. The file cannot compile as it stands onmain, so this PR also deduplicates it down to the single intended nav structure (NavLinkbrand with active-route styling, network badge, hamburger + drawer, focus trap) - kept as minimal as possible, no behavior changes beyond making it valid again.Test plan
frontend/src/test/SkipToMainContent.test.jsx: skip link is the first Tab stop ahead of every nav link, activating it moves focus to#main-content, link carries the visually-hidden-until-focus classfrontend/src/test/NavbarActiveRoute.test.jsx(pre-existing) passes again now thatNavbar.jsxcompilespnpm exec vitest run- no new failures introduced (16 pre-existing failures elsewhere in the suite, e.g.api.getOrdersStreamUrl is not a function, confirmed present on unmodifiedmaintoo, unrelated to this change)