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

未关闭 适合新手
#15,440 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
html, javascript
领域
accessibility

调研方向

从 src/resources/formats/html/templates/quarto-html-after-body.ejs 开始,issue 指出外部链接装饰和 opensNewContext 检查在此处定义。比较图标使用的选择器与目标检查,然后查看附近有关 HTML 链接装饰的测试。当打开新上下文的导航栏链接获得隐藏描述,且外部链接图标保留现有排除条件时,即为完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
JavaScript
星标
6.2k
派生
492
平均合并
13 小时 51 分钟
30 天内合并 PR
82

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/quarto-cli 的其他 Issue

查看 quarto-dev/quarto-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。