Repository navigation
fix(PageSidebar): keep collapsed content out of the tab order - #12720
Sophran-fbj wants to merge 1 commit into
Conversation
Assisted-by: OpenAI Codex
|
No actionable comments were generated in the recent review. Walkthrough
ChangesCollapsed sidebar focus handling
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
gabipodolnikova
left a comment
There was a problem hiding this comment.
Thank you for contributing, and for a well-scoped accessibility fix! 🎉
Verdict: Approve — the fix is correct and merge-ready as-is; two minor non-blocking notes inline.
What I verified:
inertis the right primitive here — it removes the collapsed sidebar's descendants from the tab order, assistive technology, and pointer events in one attribute, pairing naturally with the existingaria-hidden(fixes the axearia-hidden-focus/ WCAG 4.1.2 violation from #12693).- The
IS_INERThelper + conditional-spread pattern matches existing usage inDrawerPanelContent,NavExpandable,Compass,TreeView,SearchInput, andInternalFormFieldGroup, and placing the spread before{...props}keeps it consumer-overridable, consistent with those components. - Simplifying the context-selector demo by dropping the manual
tabIndex={-1}workaround (and updating the docs) is a nice consumer-facing win. - The Cypress regression tests real Tab-keypress focus order at 390px in both collapsed and expanded states — much stronger than attribute-only assertions.
One behavior note worth keeping in release notes: collapsed sidebar content is now also non-clickable (inert blocks pointer events), which matches the visually-hidden intent but is a visible change from before.
| className | ||
| )} | ||
| aria-hidden={!sidebarOpen} | ||
| {...(!sidebarOpen && { inert: IS_INERT })} |
There was a problem hiding this comment.
Non-blocking: since the jest suites run on every PR while the Cypress suite is slower and easier to miss regressions in, would you be open to adding a small unit test in PageSidebar.test.tsx asserting that inert is present when sidebarOpen is false and removed when it becomes true? The current coverage only lives in the integration suite.
Happy to see this merged either way — just cheap insurance for future refactors.
| }); | ||
| }); | ||
|
|
||
| it('skips the sidebar link when collapsed and reaches it when expanded', { browser: '!firefox' }, () => { |
There was a problem hiding this comment.
Question (non-blocking): is the { browser: '!firefox' } exclusion needed? inert has been supported in Firefox since v112, so if this is about cy.press() availability rather than inert support, a short comment (or dropping the exclusion) would help future readers and extend coverage.
What: Closes #12693
A collapsed
PageSidebaris hidden from assistive technology, but keyboard users could still tab into links and controls rendered inside it. Set nativeinerton the collapsed sidebar using PatternFly's existing React compatibility helper. Expanding the sidebar restores keyboard access. The context-selector demo now relies on the sidebar for this behavior.The Cypress regression uses a native Tab keypress at 390 px. On upstream
main, focus went to the collapsed sidebar link. With the fix, it moves to the main-content link and can reach the sidebar link again after expansion.Validation
yarn test:integration --browser <electron|chrome> --spec 'cypress/integration/page.spec.ts,cypress/integration/pagemanagedsidebarclosed.spec.ts'— 5 passed in each browser.yarn exec jest --runInBand --testPathPattern 'components/(Page|Nav)/__tests__'— 171 passed across 17 suites.yarn lint:all,yarn build:esm,yarn build:cjs,yarn build:subpaths,yarn build:single:packages, andyarn build:integrationpassed. I used the published@patternfly/react-tokens@6.7.0artifacts for the local Windows build after interrupting slow token generation.Additional issues: PatternFly Page design documentation.
Assisted-by: OpenAI Codex
Summary by CodeRabbit