Repository navigation
fix: omit the content of a closed details element from the tree - #266
Merged
Merged
Conversation
A closed <details> renders its content (everything except its summary) with content-visibility: hidden, which skips the contents and makes them inaccessible, similar to display: none. Partially addresses guidepup#254
cmorten
approved these changes
Oct 22, 2026
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.
Note
AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.
Issue
Partially addresses #254.
Details
A closed
<details>was read in full, including content that is not rendered:As discussed in the issue, the HTML rendering section gives the details content slot
content-visibility: hiddenwhile theopenattribute is absent, and CSS Containment says skipped contents must not be accessible to user-agent features (similar todisplay: none).isHiddenFromAccessibilityTreenow treats a node as hidden when its parent is adetailselement withoutopenand the node is not the details' summary (the firstsummarychild element, per "summary for its parent details"). This covers child elements and bare text nodes. The example above now reads:Open
<details>elements are unchanged. This PR does not change the role of<summary>: per the discussion in the issue, the specs give it no corresponding role, so that part of the issue is left as is.New tests in
test/int/detailsSummary.int.test.tscover a closed details (child element and text content hidden), a closed details with twosummaryelements (only the first is read), and an open details (content still read).How it was tested (in a Linux container, Node 24, yarn 1.22):
yarn jest test/int/detailsSummary.int.test.tsbefore the source change: 2 of 3 tests fail (the closed details' paragraph, text and second summary are announced).yarn ci(clean, lint, test:coverage, build, types:test): passes; 58 suites / 338 tests, coverage thresholds met (98.34% statements, 95.11% branches, 100% functions), attw reports no problems.CheckList