Repository navigation
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).
The non-collapsible header was built and then overwritten by the collapsible path. Fill the header in exactly one place for each case.
Remove only the UA button styles (appearance, background, border, padding, font, color, text alignment, letter spacing). Display, cursor and box-sizing no longer need to be restored, and forced-colors handling stays the browser default.
…le-button # Conflicts: # news/changelog-1.11.md
cwickham
marked this pull request as ready for review
October 23, 2026 17:15
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. Fixes #15177. 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.NoteRemember) #15177).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. With forced colors (Chromium emulation), the header looks the same as onmain, and the focus ring uses the system highlight color.Manual check: on a test page with every appearance, margin content, and links in the title, body and margin note, I tabbed to each collapsible header and opened and closed it with Enter and Space. Links in the body and margin note work when the callout is open and leave the Tab order when it is collapsed. VoiceOver announces each header as a button with the callout type, title and expanded state.
axe: the
aria-allowed-attrfinding (35 instances on the test page) is gone.Links in a collapsible title: a link, cross-reference, or footnote marker in the title is now inside the button, so axe reports
nested-interactive. This PR does not change how these links behave: in Chromium and WebKit, a click on a link or cross-reference already toggles the callout and does not follow the link. We could add a note to the callout docs that collapsible titles should not contain links.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.Checklist
I have (if applicable):
Tests: a smoke-all test for the markup, including margin content in a collapsible callout (
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