Skip to content

[Studio UI] Add aria-expanded to tree nodes - #4050

Closed
idaiv wants to merge 4 commits into
2026.xfrom
fix/tree-aria-states
Closed

[Studio UI] Add aria-expanded to tree nodes#4050
idaiv wants to merge 4 commits into
2026.xfrom
fix/tree-aria-states

Conversation

@idaiv

@idaiv idaiv commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expandable tree nodes now expose aria-expanded={true|false} so screen readers announce folder open/closed state
  • Only set on nodes with children; leaf nodes omit the attribute
  • aria-selected deferred to ARIA roles PR (requires role="treeitem", current role is "button")

Test plan

  • Inspect a folder node in DevTools — verify aria-expanded="false" when collapsed
  • Expand the folder — verify aria-expanded="true"
  • Inspect a leaf node — verify no aria-expanded attribute
  • Test with screen reader (NVDA/VoiceOver) — verify folder state is announced

🤖 Generated with Claude Code

Expandable tree nodes now expose aria-expanded={true|false} so screen
readers announce whether a folder is open or closed. Only set on nodes
that have children; leaf nodes omit the attribute entirely.

Note: aria-selected requires role="treeitem" (current role is "button")
and will be added in the follow-up ARIA roles PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 31, 2026 13:28
@idaiv idaiv added the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Verdict: Needs changes. The PR adds expansion-state semantics to the shared tree-node component.

Changes:

  • Adds aria-expanded to expandable nodes.
  • Omits the attribute from detected leaf nodes.

Review:

  • Root cause/boundary: Correctly targets the owning TreeNode component.
  • Coverage: All consumers inherit the behavior, but children does not match the actual hasChildren expansion condition.
  • Compatibility: Additive; no public API break.
  • Tests/docs: Automated regression coverage is missing; no documentation change is necessary.
  • Risk: Screen-reader behavior remains manually unverified.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const nodeContent = (
<Flex
align="center"
aria-expanded={ isExpandable ? isExpanded : undefined }
Comment thread assets/js/src/core/components/element-tree/node/tree-node.tsx Outdated
idaiv and others added 3 commits August 31, 2026 13:35
props.children is not an expansion source — TreeExpander only renders
when hasChildren is true. Remove the redundant children length check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

idaiv commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #4048 which includes aria-expanded along with the full tree navigation rewrite.

@idaiv idaiv closed this Sep 1, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Skip Milestone Check Exempts this PR from the mandatory milestone requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants