quarto-dev / quarto-dev/quarto-cli
Skip link href is rewritten to a cross-document URL on index.html
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
On a website's index.html, quarto-nav.js rewrites the skip-to-content link so its href points at a different document than the page it is on. The link is emitted as a same-document fragment:
<a id="quarto-skip-link" class="visually-hidden-focusable" href="#quarto-document-content">
At load time, quarto-nav.js walks every <a> and strips a trailing /index.html from its resolved href:
For the skip link, links[i].href reads back as the fully resolved URL, so on http://host/index.html it is http://host/index.html#quarto-document-content. The regex matches /index.html followed by #, and the href becomes http://host/#quarto-document-content — a URL whose path no longer matches the document's.
Two consequences:
- The link is no longer a same-document fragment, so activating it navigates to
/and reloads instead of moving focus within the current page. That defeats the purpose of a skip link for keyboard users, which is what #14684 added it for. axe-core'sregionrule exempts skip links from "all page content should be contained by landmarks" only when the href is a same-document fragment. With the rewritten href the exemption is lost, so every scan of a Quarto site reports aregionviolation on#quarto-skip-link, on the home page only.
The rewrite is intentional for ordinary navigation links (#14667 refined the regex). It should not apply to links that were authored as bare fragments.
Steps to reproduce
---
title: "Trail Notes"
---
Notes from walking the coast path.
With a minimal _quarto.yml:
project:
type: website
website:
title: "Trail Notes"
navbar:
left:
- href: index.qmd
text: Home
Then:
quarto render
quarto call axe _site
Or, without the scanner: serve _site over HTTP, open /index.html, and read document.getElementById("quarto-skip-link").href in the console.
Actual behavior
On /index.html, the skip link's href resolves to a different document:
href = http://127.0.0.1:5503/#quarto-document-content
data-original-href = http://127.0.0.1:5503/index.html#quarto-document-content
quarto call axe _site reports the region violation on the home page and not on any other page:
index.html 1440x900 light 3 color-contrast,image-alt,region
index.html 1440x900 dark 2 image-alt,region
gear.html 1440x900 light 0 (none)
ID IMPACT STANDARD N PAGES STATUS
region-5ae782 moderate Best Practice 1 1 new
**Standard:** Best Practice · **Impact:** moderate · **Signature:** `region :: #quarto-skip-link`
**Problem:** Some page content is not contained by landmarks
Pages other than index.html are unaffected: their rewrite is a no-op, the href stays same-document, and region does not fire. The two pages have identical landmark structure.
Expected behavior
The skip link keeps a same-document href on every page, including index.html. Activating it moves focus to the main content without a navigation, and axe-core's region rule continues to exempt it.
Skipping the rewrite for links authored as bare fragments would fix it. The pre-resolution attribute value is available as links[i].getAttribute("href"), so a link whose attribute starts with # can be left alone.
Your environment
- IDE: Positron 1.130.0
- OS: macOS 26.6.2 (build 25G83)
Quarto check output
Quarto 1.11.4
[✓] Checking environment information...
Quarto cache location: /Users/charlottewickham/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.10.0: OK
Dart Sass version 1.101.0: OK
Deno version 2.7.14: OK
Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.11.4
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2026.04
Chrome Headless Shell: 150.0.7871.115
VeraPDF: 1.28.2
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/charlottewickham/Library/TinyTeX/bin/universal-darwin
Version: 2026
[✓] Checking Chrome Headless....................OK
Using: Chrome Headless Shell installed by Quarto
Path: /Users/charlottewickham/Library/Application Support/quarto/chrome-headless-shell/chrome-headless-shell-mac-arm64/chrome-headless-shell
Version: 150.0.7871.115
[✓] Checking basic markdown render....OK
[✓] Checking R installation...........OK
Version: 4.6.0
Path: /Library/Frameworks/R.framework/Versions/4.6/Resources
LibPaths:
- /Users/charlottewickham/Library/R/arm64/4.6/library
- /Library/Frameworks/R.framework/Versions/4.6/Resources/library
knitr: 1.51
rmarkdown: 2.31
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
Version: 3.12.2
Path: /Users/charlottewickham/.pyenv/versions/3.12.2/bin/python3
Jupyter: 5.9.1
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking Julia installation...
AI-assisted investigation
- AI tool used: Claude Code
- Codebase grounding: local clone
- Human review: I have reviewed, tested, and verified the AI-generated content before submitting.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/resources/projects/website/navigation/quarto-nav.js at the link-rewrite logic around lines 271-282, then reproduce with the minimal QMD and _quarto.yml example. Run quarto render followed by quarto call axe _site, and verify that the skip link on /index.html remains a same-document fragment and the home page no longer reports the region violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100