Skip to content

[A11y] Announce Expansible expansion status - #174169

Closed
victorsanni wants to merge 5 commits into
flutter:masterfrom
victorsanni:expansible-semantics
Closed

victorsanni wants to merge 5 commits into
flutter:masterfrom
victorsanni:expansible-semantics

Conversation

@victorsanni

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages a: internationalization Supporting other languages or locales. (aka i18n) labels Aug 20, 2025

@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 refactors the accessibility announcements for expansion state from ExpansionTile to the more generic Expansible widget. This is a good architectural improvement. However, there is a critical issue where the new accessibility strings (expandedHint and collapsedHint) have not been translated for any of the non-English locales, using the English text as a placeholder. This defeats the purpose of localization and must be addressed. Additionally, the documentation for these new localization properties in widgets/localizations.dart is confusing and should be clarified to avoid misuse.

Comment on lines +17 to +18
"expandedHint": "Collapsed",
"collapsedHint": "Expanded"

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.

critical

The new accessibility hints expandedHint and collapsedHint must be translated into Afrikaans. Currently, they contain the English source strings.

This is a critical accessibility issue and applies to all other non-English .arb files modified in this pull request. Please provide translations for all supported languages.

Comment on lines +205 to +209
/// The semantics hint to describe the [Expansible] expanded state.
String get expandedHint => 'Collapsed';

/// The semantics hint to describe the [Expansible] collapsed state.
String get collapsedHint => 'Expanded';

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.

medium

The documentation for expandedHint and collapsedHint is confusing. The names and descriptions don't clearly convey what state they represent. While the implementation logic is correct, the documentation could be improved to prevent misunderstanding by clarifying that the hint describes the state the widget will transition to when tapped.

The descriptions in the en.arb file are much clearer. Consider updating the documentation here to be more explicit.1

  /// The hint announced when an expanded [Expansible] is tapped, which collapses it.
  String get expandedHint => 'Collapsed';

  /// The hint announced when a collapsed [Expansible] is tapped, which expands it.
  String get collapsedHint => 'Expanded';

Style Guide References

Footnotes

  1. Documentation should be useful and explain the 'why' and the 'how' to avoid confusion. (link) ↩

@victorsanni
victorsanni requested a review from chunhtai August 21, 2025 16:30
@victorsanni

Copy link
Copy Markdown
Contributor Author

This is not a breaking change for localization.

@chunhtai chunhtai 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.

LGTM, just a minor suggestion

@victorsanni

Copy link
Copy Markdown
Contributor Author

Blocked on #174365

@hannah-hyj hannah-hyj 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

super.dispose();
}

void _announceSemantics() {

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.

Instead of using the announcement service for this, can we use a combination of live region and the expanded hint? I am also working on this in another PR to do exactly that but in the ExpansionTile.

@victorsanni

Copy link
Copy Markdown
Contributor Author

Blocked on #174598

@Piinks

Piinks commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still on your radar?

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

Labels

a: internationalization Supporting other languages or locales. (aka i18n) framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants