Skip to content

[A11y] Add Semantics tree node details - #10018

Merged
hannah-hyj merged 4 commits into
flutter:masterfrom
hannah-hyj:a11y_node_details
Oct 1, 2026
Merged

hannah-hyj merged 4 commits into
flutter:masterfrom
hannah-hyj:a11y_node_details

Conversation

@hannah-hyj

@hannah-hyj hannah-hyj commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

tracking issue: #9893

So it will display a selected node details
Screenshot 2026-09-22 at 14 10 37

Pre-launch Checklist

General checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

If you need help, consider asking for help on Discord.

@hannah-hyj
hannah-hyj requested a review from a team as a code owner September 22, 2026 21:08
@hannah-hyj
hannah-hyj requested review from elliette and srawlins and removed request for a team September 22, 2026 21:08

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new SemanticsNodeDetailsPane to display detailed properties (such as label, value, hint, bounding box, and flags) of the selected semantics node in the accessibility screen. It updates the AccessibilityController and SemanticsNodeModel to support node selection, parses additional node details from JSON, and updates the layout and tests accordingly. The review feedback highlights a potential runtime crash in _formatNumber when formatting non-finite coordinates, suggests adding an early-return guard in selectSemanticsNode to avoid redundant state updates, and recommends using safer is num type checks instead of explicit casts in parseRect to prevent runtime type errors.

title: _valueTitle,
description: _valueDescription,
child: _NodeDetailValueBox(
text: node.value.isNotEmpty ? '"${node.value}"' : null,

@elliette elliette Sep 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like there is a check for whether text is empty in _NodeDetailValueBox, so instead of this ternary could we simply pass _NodeDetailValueBox(text: node.value) and have _NodeDetailValueBox handle wrapping the text in quotation?

(Basically is there a way to remove the ternary and empty check from the call site here and below and into the implementation of _NodeDetailValueBox?)

Comment on lines +171 to +178
final textStyle = !hasValue
? theme.subtleFixedFontStyle
: highlightText
? theme.fixedFontStyle.copyWith(
color: colorScheme.primary,
fontWeight: FontWeight.bold,
)
: theme.fixedFontStyle;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[optional] I find nested ternaries hard to read, consider pulling this into method to avoid the nesting

@hannah-hyj
hannah-hyj requested a review from elliette September 25, 2026 04:07

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with one suggestion! Sorry for the delay here.

dataRootsListenable: controller.semanticsRoots,
scrollController: controller.treeScrollController,
includeScrollbar: true,
onItemSelected: controller.selectSemanticsNode,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might want to add onItemExpanded as well - I'm guessing right now every time an item is expanded it is automatically selected as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah your guess was correct lol!
updated so expand will not auto select !

@hannah-hyj

Copy link
Copy Markdown
Member Author

Thank you for reviewing! :D

@hannah-hyj
hannah-hyj merged commit ebbbda1 into flutter:master Oct 1, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants