From d1e34be2affdecebfe28c9381ac5559746efcb72 Mon Sep 17 00:00:00 2001 From: Charlotte Wickham Date: Tue, 8 Sep 2026 08:33:45 -0700 Subject: [PATCH] Use the browser focus ring for sidebar section toggles The sidebar section toggles from #14826 drew their own focus ring (`outline: 2px solid currentColor` with `outline-offset: 2px`). Every other control in a Quarto page takes the browser's ring, so tabbing down the sidebar stepped from a browser ring, to this one, and back again. The comment on the rule said a bare button gets no ring from Bootstrap's reboot. Reboot only clears the ring for `:focus:not(:focus-visible)`, which is the mouse-click case, and these buttons carry no `btn` class, so nothing suppressed their ring. Measured in Chromium, Firefox and WebKit: with the rule gone the buttons compute `outline-style: auto`, and the ring is not clipped by the sidebar. Delete the rule, state the convention where the one `outline: revert` rule lives, and record it in the sass-theming rules file. Extend the focus-indicator spec to cover the section toggles. --- .claude/rules/formats/sass-theming.md | 28 ++++++++++++ .../html/bootstrap/_bootstrap-rules.scss | 18 ++++++-- .../website/navigation/quarto-nav.scss | 8 ---- .../website/bare-btn-focus/_quarto.yml | 3 ++ .../website/bare-btn-focus/index.qmd | 12 +++-- ...n.spec.ts => html-focus-indicator.spec.ts} | 45 ++++++++++++++++--- 6 files changed, 93 insertions(+), 21 deletions(-) rename tests/integration/playwright/tests/{html-focus-indicator-bare-btn.spec.ts => html-focus-indicator.spec.ts} (59%) diff --git a/.claude/rules/formats/sass-theming.md b/.claude/rules/formats/sass-theming.md index 99f421dc77..a156966942 100644 --- a/.claude/rules/formats/sass-theming.md +++ b/.claude/rules/formats/sass-theming.md @@ -6,6 +6,7 @@ paths: - "src/format/reveal/format-reveal-theme*" - "src/format/dashboard/format-dashboard-shared*" - "src/resources/formats/**/*.scss" + - "src/resources/projects/**/*.scss" --- # Sass Theming @@ -22,3 +23,30 @@ background-color: var(--r-background-color, $body-bg); Read `llm-docs/sass-theming-architecture.md` for full compilation pipeline details. For the three-tier callout CSS architecture (Bootstrap, RevealJS, standalone HTML), see `llm-docs/callout-styling-html.md`. + +## Focus indicators + +Never author a focus ring. The browser's own ring adapts to the platform accent +color, to the user's accessibility settings, and to forced-colors mode, where +`box-shadow` is dropped entirely. An authored ring does none of that, and a +second convention next to the first is visible as an inconsistency when a user +tabs through a page. + +So the only focus rules Quarto writes are ones that undo a vendor rule which +suppressed the browser ring: + +```scss +// a bare .btn: Bootstrap's .btn:focus-visible sets outline: 0 +.code-tools-button:focus-visible { + outline: revert; +} +``` + +A bare `