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

Abierto Apto para principiantes
#14,875 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript

Línea de trabajo

Comienza en src/resources/projects/website/navigation/quarto-nav.js, en la lógica de reescritura de enlaces alrededor de las líneas 271-282, y después reproduce el problema con el ejemplo mínimo de QMD y _quarto.yml. Ejecuta quarto render seguido de quarto call axe _site y verifica que el skip link de /index.html siga siendo un fragmento del mismo documento y que la página de inicio ya no informe de la infracción de región.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
JavaScript
Estrellas
6k
Forks
458
Merge medio
1 d 9 h
PR fusionados (30 d)
41

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/quarto-cli

Todos los issues de quarto-dev/quarto-cli

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.