Conversation
The collapse toggle was a div with aria-expanded, no role, no tab stop and an aria-label that hid the title. The header now wraps its icon, title and chevron in a <button> (APG disclosure pattern), so it is reachable with Tab, operable with Enter/Space, and named by the callout type and title. Rendering is pixel-identical to main in Chromium and WebKit for default, simple and minimal callouts, collapsed and expanded, apart from the new focus ring. Fixes #4934
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…llm-docs The collapsed state now lives on the toggle button, not the header (#4934).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4934. The header of a collapsible callout was a
<div>witharia-expanded, no role, and no tab stop. Itsaria-label="Toggle callout"also hid the title from screen readers.The header now wraps the icon, title, and chevron in a native
<button>(the APG disclosure pattern):.callout-N-contentsclass. Margin content that moves out of the callout keeps this class, so it still collapses with the callout.collapsedon the trigger only. Thus the corner-radius rule now uses:has(> .callout-toggle-btn.collapsed)instead of a class on the header.No visual change. I rendered 48 callouts with
mainand with this branch: all types, the default, simple, and minimal appearances, collapsed and expanded, static callouts, and margin content. All screenshots are pixel-identical in Chromium and WebKit, before and after a toggle. The only new visual is the focus ring on keyboard focus.axe: the
aria-allowed-attrfinding (35 instances on the test page) is gone. A link in a collapsible title is now inside the button, so axe reportsnested-interactive. Authors must not put links in a collapsible title.Custom CSS: selectors for collapsible callouts change.
.callout-header[aria-expanded]and.callout-header.collapsedbecome.callout-toggle-btn[aria-expanded]and.callout-toggle-btn.collapsed. The icon and title containers are now<span>, sodiv.callout-title-containerno longer matches collapsible callouts. A GitHub code search found no hand-written CSS that uses the old header selectors. The one script it found addsrole="button"to the header, which is a workaround for this issue. The changelog entry states the change.Checklist
I have (if applicable):
Tests: a smoke-all test for the markup (
callouts/a11y/issue-4934.qmd) and a Playwright keyboard test (html-callouts.spec.ts). The existing callout tests pass locally. I did not run the full suite locally; CI covers it.AI-assisted PR