Skip link href is rewritten to a cross-document URL on index.html

オープン 初心者向け
#14,875 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript

調査の方向性

src/resources/projects/website/navigation/quarto-nav.js の271-282行目付近にあるリンク書き換えロジックから始め、続いて最小限の QMD と _quarto.yml の例で再現します。quarto render に続けて quarto call axe _site を実行し、/index.html の skip link が同一ドキュメント内のフラグメントのままになっていること、またホームページで region 違反が報告されなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

説明

bug

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:

https://github.com/quarto-dev/quarto-cli/blob/7ee762a4ceb4c1750660a124e042fecdc073e29d/src/resources/projects/website/navigation/quarto-nav.js#L271-L282

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:

  1. 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.
  2. axe-core's region rule 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 a region violation 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.
主要言語
JavaScript
スター
6k
フォーク
458
平均マージ
1日 9時間
マージ済み PR(30日)
41

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/quarto-cli のほかの issue

quarto-dev/quarto-cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。