From 7f28d83162c078425a0cc469be9170a0f8a10fbe Mon Sep 17 00:00:00 2001 From: Greg Lin Date: Sun, 17 Aug 2025 18:19:56 -0500 Subject: [PATCH 1/2] a11y: fix keyboard navigation for tabset panels in websites when using an HTML theme --- news/changelog-1.8.md | 1 + src/resources/filters/customnodes/panel-tabset.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/news/changelog-1.8.md b/news/changelog-1.8.md index 51572044710..ba2b84abce2 100644 --- a/news/changelog-1.8.md +++ b/news/changelog-1.8.md @@ -66,6 +66,7 @@ All changes included in 1.8: ### `website` +- ([#10284](https://github.com/quarto-dev/quarto-cli/issues/10284)): a11y - Fix keyboard navigation for tabset panels when using an HTML theme. Tabs now properly receive keyboard focus. - ([#12551](https://github.com/quarto-dev/quarto-cli/pull/12551)): Improve warning issued when `aliases` would overwrite an existing document. - ([#12616](https://github.com/quarto-dev/quarto-cli/issues/12616)): find SVG images in image discovery for listings. - ([#12693](https://github.com/quarto-dev/quarto-cli/issues/12693)): Prevent resource exhaustion on large websites by serializing `NotebookContext` information to file instead of the environment. diff --git a/src/resources/filters/customnodes/panel-tabset.lua b/src/resources/filters/customnodes/panel-tabset.lua index 03b208fb88a..75972b75050 100644 --- a/src/resources/filters/customnodes/panel-tabset.lua +++ b/src/resources/filters/customnodes/panel-tabset.lua @@ -286,7 +286,7 @@ function bootstrapTabs() active = " active" selected = "true" end - return 'class="nav-link' .. active .. '" id="' .. tablinkid .. '" data-bs-toggle="tab" data-bs-target="#' .. tabid .. '" role="tab" aria-controls="' .. tabid .. '" aria-selected="' .. selected .. '"' + return 'class="nav-link' .. active .. '" id="' .. tablinkid .. '" data-bs-toggle="tab" data-bs-target="#' .. tabid .. '" role="tab" aria-controls="' .. tabid .. '" aria-selected="' .. selected .. '" href=""' end, paneAttribs = function(tabid, isActive, headingAttribs) local tablinkid = tabid .. "-tab" From 69b0bcc934e13a8d3c09f6c1451375809d596db8 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Wed, 20 Aug 2025 13:35:31 -0500 Subject: [PATCH 2/2] regression test --- .../2025/08/20/issue-13233/.gitignore | 1 + .../2025/08/20/issue-13233/_quarto.yml | 21 +++++++++++++++++++ .../2025/08/20/issue-13233/about.qmd | 5 +++++ .../2025/08/20/issue-13233/index.qmd | 21 +++++++++++++++++++ .../2025/08/20/issue-13233/styles.css | 1 + 5 files changed, 49 insertions(+) create mode 100644 tests/docs/smoke-all/2025/08/20/issue-13233/.gitignore create mode 100644 tests/docs/smoke-all/2025/08/20/issue-13233/_quarto.yml create mode 100644 tests/docs/smoke-all/2025/08/20/issue-13233/about.qmd create mode 100644 tests/docs/smoke-all/2025/08/20/issue-13233/index.qmd create mode 100644 tests/docs/smoke-all/2025/08/20/issue-13233/styles.css diff --git a/tests/docs/smoke-all/2025/08/20/issue-13233/.gitignore b/tests/docs/smoke-all/2025/08/20/issue-13233/.gitignore new file mode 100644 index 00000000000..075b2542afb --- /dev/null +++ b/tests/docs/smoke-all/2025/08/20/issue-13233/.gitignore @@ -0,0 +1 @@ +/.quarto/ diff --git a/tests/docs/smoke-all/2025/08/20/issue-13233/_quarto.yml b/tests/docs/smoke-all/2025/08/20/issue-13233/_quarto.yml new file mode 100644 index 00000000000..357b006b20b --- /dev/null +++ b/tests/docs/smoke-all/2025/08/20/issue-13233/_quarto.yml @@ -0,0 +1,21 @@ +project: + type: website + +website: + title: "issue-13233" + navbar: + left: + - href: index.qmd + text: Home + - about.qmd + +format: + html: + theme: + - cosmo + - brand + css: styles.css + toc: true + + + diff --git a/tests/docs/smoke-all/2025/08/20/issue-13233/about.qmd b/tests/docs/smoke-all/2025/08/20/issue-13233/about.qmd new file mode 100644 index 00000000000..07c5e7f9d13 --- /dev/null +++ b/tests/docs/smoke-all/2025/08/20/issue-13233/about.qmd @@ -0,0 +1,5 @@ +--- +title: "About" +--- + +About this site diff --git a/tests/docs/smoke-all/2025/08/20/issue-13233/index.qmd b/tests/docs/smoke-all/2025/08/20/issue-13233/index.qmd new file mode 100644 index 00000000000..4d5fcfda60b --- /dev/null +++ b/tests/docs/smoke-all/2025/08/20/issue-13233/index.qmd @@ -0,0 +1,21 @@ +--- +title: "mysite" +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['href=""'] +--- + +::: {.panel-tabset} + +## First tab + +1. Press Tab. "First tab" should be focused. +2. Press Right Arrow. "Second tab" should now be active and focused. + +## Second tab + +Other text might go here + +::: diff --git a/tests/docs/smoke-all/2025/08/20/issue-13233/styles.css b/tests/docs/smoke-all/2025/08/20/issue-13233/styles.css new file mode 100644 index 00000000000..2ddf50c7b42 --- /dev/null +++ b/tests/docs/smoke-all/2025/08/20/issue-13233/styles.css @@ -0,0 +1 @@ +/* css styles */