Skip to content

fix(naked_ui): keep focus semantics on a disclosure with a semanticLabel - #317

Open
leoafarias wants to merge 2 commits into
mainfrom
fix/naked-ui-disclosure-semantic-label
Open

leoafarias wants to merge 2 commits into
mainfrom
fix/naked-ui-disclosure-semantic-label

Conversation

@leoafarias

@leoafarias leoafarias commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Description

A NakedDisclosure with an explicit semanticLabel wrapped its whole trigger in Semantics(excludeSemantics: true). That replaced the visual content's name as intended, but it also removed the trigger's focus action and focused state, so assistive technology could not report or move focus to a labelled disclosure. On the web the labelled trigger's button also had no tabindex and never received DOM focus.

Now only the visual trigger content is excluded. The replacement label and hint still apply to the button node, and the surrounding focus semantics stay intact. Disclosures without a semanticLabel are unchanged.

Validation

  • New test: a labelled disclosure exposes the focus action, performing it focuses the trigger, and the focused state follows. It fails on main (no focus action) and passes with the fix.
  • The label test still checks replacement without duplication (one button node, label and hint, no visible text in the label), and now waits a frame before reading the controlled panel so it also holds on the web.
  • New test: disabled and read-only labelled disclosures stay disabled.
  • naked_ui test suite: passed. dart analyze (no new issues), root dart format check, melos run ci:checks: passed.

Related Issues

None.


Checklist

  • My PR includes unit or integration tests for all changed/updated/fixed behaviors.
  • I have updated or added relevant documentation (doc comments with ///).
  • I am prepared to follow up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

A NakedDisclosure with an explicit semanticLabel wrapped the trigger in
Semantics(excludeSemantics: true), which also dropped the trigger's focus
action and focused state from the semantics tree. Exclude only the visual
trigger content instead, so the label still replaces it while the
surrounding focus semantics survive.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T18:02:31.175593Z 0010738 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Give the focus contract its own test that performs the semantics focus
action, keep the label test about replacement, wait a frame before reading
the controlled panel so the test also holds on the web, and drop the
activation test that could not detect this change. Clarify the comment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant