Skip to content

Add skip-to-content link to Bootstrap-themed HTML output#14685

Open
cscheid wants to merge 2 commits into
mainfrom
fix/14684-skip-to-content
Open

Add skip-to-content link to Bootstrap-themed HTML output#14685
cscheid wants to merge 2 commits into
mainfrom
fix/14684-skip-to-content

Conversation

@cscheid

@cscheid cscheid commented Jul 14, 2026

Copy link
Copy Markdown
Member

Closes #14684.

What this does

Adds a "Skip to main content" link as the first element of <body> for all Bootstrap-themed HTML output — standalone documents, websites, books, manuscripts, and dashboards — so keyboard and switch users can bypass navigation blocks (WCAG 2.2 SC 2.4.1 "Bypass Blocks", Level A). No JavaScript involved.

  • The link is injected by the bootstrap HTML postprocessor, so a single implementation covers every Bootstrap-based output shape (dashboards call the base HTML format extras, so they get it too). theme: none / minimal output is untouched.
  • Target resolution falls back gracefully: #quarto-document-content → first <main>div.page-layout-custom (dashboards, standalone custom layouts) → #quarto-content (website custom layouts). If the target has no id it is assigned quarto-document-content, and it gets tabindex="-1" so activating the link moves focus, not just scroll position.
  • Visually hidden via Bootstrap's .visually-hidden-focusable helper (already compiled into every theme); when focused it appears as a fixed-position pill above the fixed/headroom navbar ($zindex-skip-link: 1070), styled from theme variables so it works in light and dark themes.
  • Link text is localizable via a new language key skip-to-content, with seeded translations for fr, de, es, pt, pt-BR, it, ja, zh, zh-TW, nl (other languages fall back to English; regional variants inherit their base language).
  • Dashboards additionally mark their content container with role="main", addressing the missing main-landmark note in the issue.

Behavior

On any page: first Tab reveals the link; Enter moves focus to the main content; the next Tab lands on the first focusable inside the content, bypassing navbar/sidebar/TOC entirely.

Tests

  • New smoke-all tests: document with TOC, dashboard, theme: none (asserts no link), page-layout: custom.
  • New site test asserting the link and target on a navbar+sidebar website page.
  • Manually verified with browser keyboard navigation (docs, website, dashboard, dark theme, lang: fr).

Notes for review

🤖 Generated with Claude Code

cscheid and others added 2 commits July 13, 2026 20:55
Inject a "Skip to main content" link as the first element of the body
for all bootstrap-themed HTML output (documents, websites, books,
dashboards) so keyboard users can bypass navigation blocks (WCAG 2.4.1
Bypass Blocks). The link is visually hidden until focused, targets the
main content container (assigning an id and tabindex="-1" where
missing), and its text is localizable via the new language key
skip-to-content. Dashboards additionally mark their content container
with role="main".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Via `quarto dev-call build-artifacts`. Includes some unrelated churn in
the editor tooling files from schema description edits that had not
been regenerated on main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@posit-snyk-bot

posit-snyk-bot commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid

cscheid commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

@cwickham, we should figure out how to document this on quarto-web.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No skip-to-content link: keyboard users must tab through all navigation on every page (WCAG 2.4.1, Level A)

2 participants