Skip to content

[6.x] Accessible routing implementation to announce page name and move focus to top of document - #19449

Merged
brandonkelly merged 5 commits into
6.xfrom
a11y/accessible-routing
Aug 18, 2026
Merged

[6.x] Accessible routing implementation to announce page name and move focus to top of document#19449
brandonkelly merged 5 commits into
6.xfrom
a11y/accessible-routing

Conversation

@gcamacho079

Copy link
Copy Markdown
Contributor

Description

This uses a pattern similar to the one we have in place on the Docs site.

In addition:

  • Replaces nonexistent color variable
  • Fixes a bug on the site index screen where the page title was undefined

Related issues

Resolves ACC-247

@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

ACC-247

@gcamacho079 gcamacho079 added the accessibility 👤 features related to accessibility label Aug 17, 2026
@gcamacho079
gcamacho079 requested a lite review from Copilot August 17, 2026 18:43

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 improves Control Panel SPA accessibility by moving keyboard focus to the top of the document on Inertia route changes and announcing the destination page name via a live region. It also fixes a Sites index screen title bug and updates a CP CSS token to use an existing color variable.

Changes:

  • Add route-change focus management and live-region announcements on Inertia navigations.
  • Fix Sites index page title being undefined by providing a server-side title prop and consuming it in the Vue page.
  • Replace a nonexistent CP CSS color variable with an existing token.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Http/Controllers/Settings/SitesController.php Adds a title Inertia prop for the Sites index page (group name or “Sites”).
resources/translations/en/app.php Adds a translatable announcement string for route-change messaging.
resources/js/pages/settings/sites/Index.vue Consumes the new title prop for the page heading and app layout title.
resources/js/common/layouts/screens/PageScreen.vue Adds a programmatic focus anchor at the top of the CP header.
resources/js/bootstrap/cp.ts Implements accessible routing behavior: focus anchor + announce page title on navigation.
packages/craftcms-ui/src/styles/cp.css Switches skip-link text color to an existing token (--c-text-default).
Suppressed comments (1)

resources/js/bootstrap/cp.ts:150

  • if (!props.title) return; relies on truthiness and can announce unexpected values (e.g. whitespace-only strings) or skip valid-but-empty titles. A small type/trim guard makes the announcement more robust.
    if (!props.title) return;

    announce(t('Navigated to {title} page', {title: props.title}));

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread resources/js/bootstrap/cp.ts Outdated
Comment thread resources/js/common/layouts/screens/PageScreen.vue
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

@gcamacho079
gcamacho079 marked this pull request as ready for review August 17, 2026 20:56
@brandonkelly
brandonkelly merged commit 0a2b80e into 6.x Aug 18, 2026
23 checks passed
@brandonkelly
brandonkelly deleted the a11y/accessible-routing branch August 18, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility 👤 features related to accessibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants