Skip to content

[material_ui] Fix ExpansionTile WidgetSpan semantics assertion - #12765

Open
ahamSel wants to merge 2 commits into
flutter:mainfrom
ahamSel:fix/material-ui-expansion-tile-widgetspan-semantics
Open

[material_ui] Fix ExpansionTile WidgetSpan semantics assertion#12765
ahamSel wants to merge 2 commits into
flutter:mainfrom
ahamSel:fix/material-ui-expansion-tile-widgetspan-semantics

Conversation

@ahamSel

@ahamSel ahamSel commented Sep 5, 2026

Copy link
Copy Markdown

On Android, embedding an ExpansionTile in a WidgetSpan can trigger a sibling-configuration conflict assertion when semantics are enabled. Its live-region Semantics uses AccessibilityFocusBlockType.blockNode but can merge into the surrounding semantics tree.

This makes the live region a semantics container, so blockNode applies to an explicit node. The Android regression test uses the simpler reproduction suggested in flutter/flutter#190639.

Fixes flutter/flutter#188298.

This ports flutter/flutter#190639 to packages/material_ui. The earlier package PR, #12383, was closed while contributions were paused. This replacement is rebased onto current main following the request to move the fix here; GitHub would not reopen the old PR after the rebase.

I used AI to help with the fix and regression test.

Pre-Review Checklist

Validation performed:

  • flutter test --no-pub test/expansion_tile_test.dart: 64 passed, one pre-existing skip.
  • Removing container: true makes the new regression test fail with the original !conflict assertion; restoring it makes the test pass.
  • flutter analyze --no-pub lib/src/expansion_tile.dart test/expansion_tile_test.dart: no issues.
  • Dart formatting and git diff --check pass.

Full repository CI is still pending. The release metadata uses material_ui's batch-release convention: a pending changelog entry with version: patch.

The repository-wide flutter_plugin_tools validate command could not complete in the local sparse checkout: its root README check requires other packages, beginning with animations, that are not checked out. This check is left to CI.

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.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 5, 2026
@ahamSel
ahamSel marked this pull request as ready for review September 5, 2026 12:06

@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 sets container: true on the Semantics widget in ExpansionTile to ensure the live region forms the node that blockNode removes from focus traversal, resolving an Android semantics assertion when embedded in a WidgetSpan. It also adds a regression test for this scenario and a changelog entry. There are no review comments, so no feedback is provided.

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

Labels

p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExpansionTile semantics assertion with nested WidgetSpan title in Flutter 3.44.2

1 participant