Navbar marks the wrong item as the current page when two items link into the same sidebar
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 75/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- html, javascript, yaml
- 領域
- accessibility, web-dev
研究方向
從 src/project/types/website/website-navigation.ts 中 issue 提到的作用中連結迴圈開始,接著查看相關 issue #9277、#15190 和 #15191 以了解背景。使用提供的 _quarto.yml 和兩個頁面重現問題,然後執行 quarto render 並檢查 _site/get-started.html。完成標準是:與目前頁面完全相符的連結處於作用中狀態,並帶有 aria-current="page";若只在側邊欄中相符,則使用 aria-current="true"。
由索引模型根據 Issue 內容生成。
描述
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
In a website with a navbar and a sidebar, the navbar marks the first item whose page is in the current sidebar as active, even when a later item links to the current page.
That item also gets aria-current="page", so a screen reader announces the wrong page as current.
The loop that latches the active link breaks on the first navbar link whose href appears anywhere in the sidebar of the current page, before it checks for an exact match:
https://github.com/quarto-dev/quarto-cli/blob/1d80652ba64516c46173120048892c6694be9fb6/src/project/types/website/website-navigation.ts#L558-L576
When "Home" and "Get started" both link to pages of the same sidebar, "Home" wins on every page of that sidebar.
Issue #9277 reports the same loop picking "Home" when the sidebar has a logo.
Related: #9277, #15190, #15191.
Steps to reproduce
_quarto.yml:
project:
type: website
website:
title: "Repro"
navbar:
left:
- href: index.qmd
text: Home
- href: get-started.qmd
text: Get started
sidebar:
style: docked
contents:
- index.qmd
- get-started.qmd
format: html
index.qmd:
---
title: Home
---
Home.
get-started.qmd:
---
title: Get started
---
Get started.
Run quarto render, then open _site/get-started.html.
Actual behavior
On get-started.html, the navbar renders:
<a class="nav-link active" href="./index.html" aria-current="page">
<a class="nav-link" href="./get-started.html">
Expected behavior
The link to the current page is active and has aria-current="page":
<a class="nav-link" href="./index.html">
<a class="nav-link active" href="./get-started.html" aria-current="page">
An exact match should win over a sidebar match.
When only a sidebar match exists, the link marks a section, not the page, so aria-current="true" fits better than "page".
Your environment
- IDE: none, command line.
- OS: macOS 27.2.
Quarto check output
Quarto 99.9.9
[✓] Checking environment information...
[✓] 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 versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
commit: 1d80652ba64516c46173120048892c6694be9fb6
- 主要語言
- JavaScript
- 星號
- 6.2k
- 分支
- 492
- 平均合併
- 15 小時 15 分鐘
- 30 天內合併 PR
- 94
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
quarto-dev/quarto-cli 的其他 Issue
-
bootstrap enhancement themes
難度 2/5 1-3 小時 新手友好度 70/100
quarto-dev/quarto-cli#15421 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 85/100
quarto-dev/quarto-cli#15408 ·
維護者通常 1 天內回覆
-
accessibility bug
難度 2/5 1-3 小時 新手友好度 79/100
quarto-dev/quarto-cli#15401 · 1 個 reaction ·
維護者通常 1 天內回覆
-
bug callouts docx regression
難度 2/5 1-3 小時 新手友好度 81/100
quarto-dev/quarto-cli#15394 · 2 則留言 ·
維護者通常 1 天內回覆
-
bug lightbox
難度 2/5 1-3 小時 新手友好度 76/100
quarto-dev/quarto-cli#15393 ·
維護者通常 1 天內回覆
查看 quarto-dev/quarto-cli 的全部 Issue
相似的 Issue
-
bug help wanted
難度 2/5 1-3 小時 新手友好度 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 13 天內回覆
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner scheme可能已有人在做 @Bensonbenyi 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 88/100
Mintplex-Labs/anything-llm#7338 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆