A navbar link with `target: _blank` is not described as opening in a new tab

Abierto Apto para principiantes
#15,440 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Empieza en src/resources/formats/html/templates/quarto-html-after-body.ejs, donde, según el issue, se definen la decoración de enlaces externos y la comprobación opensNewContext. Compara el selector usado para el icono con la comprobación del destino y luego revisa los tests cercanos sobre la decoración de enlaces HTML. El trabajo estará terminado cuando los enlaces de la barra de navegación que abren un contexto nuevo reciban la descripción oculta y el icono de enlace externo conserve sus exclusiones actuales.

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

Descripción

accessibility 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

This is a follow-up to #9469, which describes a link that link-external-newwindow opens in a new tab to assistive technology.
It adds aria-describedby="quarto-ext-newwindow-label", which points to a hidden "(opens in a new tab)" note.
That decoration reuses the selector of the external link icon, which excludes .nav-link, .navbar-brand, and .quarto-navigation-tool, so it never reaches the navbar:

The icon exclusion makes sense, since a navbar link should not get the external link icon.
The description is a different matter: a navbar item with target: _blank opens a new tab and gives no sign of it to assistive technology.
This is the case that WCAG 3.2.5 Change on Request (Level AAA) covers, when the link text does not say it.
An icon-only navbar link has the same problem.

The description could be added to any link, navbar included, whose target is not _self, _parent, or _top, the same test as opensNewContext in that file, while the icon keeps its current selector.

Related: #5985.

Steps to reproduce

_quarto.yml:

project:
  type: website
website:
  title: New tab
  navbar:
    left:
      - href: index.qmd
        text: Home
      - href: https://quarto.org
        text: Quarto
        target: _blank
    right:
      - icon: github
        href: https://github.com/quarto-dev/quarto-cli
        aria-label: Quarto on GitHub
        target: _blank
format:
  html:
    link-external-newwindow: true

index.qmd:

---
title: Home
---

Home page. [External](https://quarto.org)

Serve the _site folder over HTTP (the decoration treats file:// pages differently), and read the links:

[...document.querySelectorAll(".navbar a.nav-link")].map((a) => [a.textContent.trim(), a.target, a.getAttribute("aria-describedby")]);
document.querySelector("main a[href^=https]").getAttribute("aria-describedby");
Actual behavior
[["Home", "", null], ["Quarto", "_blank", null], ["", "_blank", null]]
"quarto-ext-newwindow-label"

The body link has the description. The two navbar links that open a new tab have none.

Expected behavior

Both navbar links with target="_blank" have aria-describedby="quarto-ext-newwindow-label", like the body link.

Your environment
  • Quarto: 99.9.9 (development build, commit 83432c0).
  • Browser: Chromium (Playwright).
  • OS: macOS 27.2.1.
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.13.0: OK
      Dart Sass version 1.107.1: OK
      Deno version 2.9.8: OK
      Typst version 0.15.1: OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 83432c028f6c07167c23f948da7067b37fe8a18b
Lenguaje dominante
JavaScript
Estrellas
6.2k
Forks
492
Merge medio
13 h 51 min
PR fusionados (30 d)
82

Preparar el entorno

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.