Skip to content

Conversation

hannah-hyj
Copy link
Member

This is a follow-up to #170935.

Noticed when in some cases Semantics(focusable: false, focused: false) becomes Semantics(focused: null). Although they are the same in flag values. However, the first one is annotated in the semantics tree, while the second one is not. This difference can sometimes cause the tree structure to change.

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. f: focus Focus traversal, gaining or losing focus labels Aug 15, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 removes the deprecated focusable property from the Focus widget's Semantics child. This change simplifies the semantics tree by removing an intermediate node in some cases, which is the intended effect. The test files have been updated accordingly to reflect these changes in the semantics tree.

My main feedback is a suggestion to improve the clarity of a test name in shortcuts_test.dart to better reflect its updated behavior. Otherwise, the changes look good.

testWidgets('Shortcuts does not insert a semantics node when includeSemantics is false', (
WidgetTester tester,
) async {
testWidgets('Shortcuts does not insert a semantics', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The new test name is a bit ambiguous. Since the test now verifies that Shortcuts doesn't insert a semantics node regardless of the includeSemantics value, a more descriptive name would improve clarity for future readers. How about something like 'Shortcuts widget does not insert a semantics node'?

    testWidgets('Shortcuts widget does not insert a semantics node', (WidgetTester tester) async {

@hannah-hyj hannah-hyj force-pushed the focus-one-line-change branch from 8e79cdc to 82a6f43 Compare August 26, 2025 00:22
@hannah-hyj hannah-hyj requested a review from chunhtai August 29, 2025 20:11
Update focus_scope.dart

1

Co-Authored-By: chunhtai <47866232+chunhtai@users.noreply.github.com>
@hannah-hyj hannah-hyj force-pushed the focus-one-line-change branch from 59a5a87 to 7c17e4a Compare August 29, 2025 20:12
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: focus Focus traversal, gaining or losing focus f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants