Repository navigation
material: a BackButton and a DataTable's checkboxes are named from the localizations - #3290
Merged
Merged
Conversation
…e localizations BackButton reads WidgetsLocalizations::back_button_label (Flutter's backButtonTooltip). A table's heading checkbox reads select_all_button_label and each row's the new select_row_label, where Flutter leaves both unnamed. The package reads its strings through one ambient_strings helper, and the German test localizations move to tests/common for every test that reads a localized name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqfW4DyGdFu4cM4nUks6cZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqfW4DyGdFu4cM4nUks6cZ
The localized-string helper is named localized, so its path no longer repeats its module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqfW4DyGdFu4cM4nUks6cZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The end-of-test audit of the material test migration found two unnamed controls. Screen readers heard them as a bare button and bare checkboxes. Both are now named from the ambient
WidgetsLocalizations, read where the control is built, the same way #3264 named a chip's delete button.BackButtonreadsWidgetsLocalizations::back_button_label("Back"). Flutter 3.50.1 shows this string,MaterialLocalizations.backButtonTooltip, as the tooltip. Flutter's text-selection toolbar reads the same string for its back button, so one FLUI string serves both, and its doc now says so.DataTable: the heading checkbox readsselect_all_button_label("Select all"), and each data row's checkbox reads the newselect_row_label(row)("Select row N", 1-based below the heading). Flutter 3.50.1's_buildCheckboxleaves both unnamed, so this goes beyond Flutter. The label is aSemanticsaround the checkbox inside the cell's container, so it names the checkbox's own node.Changes
flui-widgets:WidgetsLocalizations::select_row_label(&self, row: usize) -> Stringis a new required method. It is implemented inDefaultWidgetsLocalizations,GlobalWidgetsLocalizations(forwarding) and the test impls. The doc ofselect_all_button_labelcovers the table heading, and the doc ofback_button_labelcovers a page's back button.flui-material: a crate-privateambient_strings(ctx, read)replaces the hand-writtenmaybe_ofplus English fallback fromchip.rs.BackButton,Chip,FilterChipandDataTableread through it. The same pattern is open-coded in about ten places influi-widgets; moving those into one shared form is a separate change.app_bar::a_back_button_is_named_in_the_ambient_languageanddata_table::the_checkboxes_are_named_in_the_ambient_language, each in English and German.icon_face'sBackButtonrow and everydata_tabletest end witht.finish()instead of expecting theUnnamedfindings.data_table's tests read the checkbox names first.chip.rsintotests/common(in_german) with Flutter's German strings: "Zurück", "Alle auswählen", "Löschen". "Zeile N auswählen" is ours, since Flutter has no such string.docs/gaps.mdentry "A back button and a data table's row checkboxes have no accessible name" (added by flui-material: surfaces, lists, fields, navigation, dialogs and the app shell are tested on the scenario tester #3285) is removed.Expectations
No baseline changed:
FLUI_PERF_BASELINE=check cargo test --locked -p flui-material --test perfpasses. The tests that expectedUnnamedfindings now expect none, because the old expectation recorded the defect this PR fixes.typos.tomlgains oneextend-ignore-reentry, the exact phraseAlle auswählen: it is Flutter's GermanselectAllButtonLabel, which the tests install to check that a name follows the locale, and typos readsAlleas an English misspelling. The entry matches only that phrase, soAlleelsewhere is still checked (typos 1.50.3 passes locally).Test plan
cargo test --locked -p flui-material -p flui-widgets: all green.cargo clippy --locked -p flui-material -p flui-widgets -p flui-cupertino --all-targets -- -D warningsis clean.cargo fmt --all --checkis clean.cargo check --locked --workspace --all-targetsis clean.BackButtonicon without its label failsicon_face's glyph test,tapping_the_implied_back_button_pops_the_routeanda_back_button_is_named_in_the_ambient_language;select_row_label(row_index)(0-based) fails fivedata_tabletests.Platforms: headless only; no native path changed.
Review
Read at head 1046e26 (base 2b71e11),
review-before-mergewithtier: "sonnet"(this PR is tests, records and a small fix): seven readers (records, tests, obligations, unwinding, boundaries, seams, rules) and a judge. The judge confirmed three nits and rejected nothing; none was left unaccounted for.on_select_changed(data_table.rs:834). Fixed in 5f3aab7:the_checkboxes_are_named_in_the_ambient_languagenow has a middle row without a handler, so the disabled checkbox's name and the 1-based numbering across a mixed table (Select row 2,Select row 3) are read in every language. Class: every case in this PR that names a control is read through the case a user can reach; the BackButton tests already cover the override and the implied-pop paths.GlobalWidgetsLocalizations::select_row_labelhas no test (global_widgets_localizations.rs:165). Fixed in 5f3aab7: the same test runs the table underGlobalWidgetsLocalizationsDelegatewith anenlocale. A hand mutation of the forwarder (row + 1) fails it with "English under the global delegate: each checkbox is named". The other forwarders in that file are untested in the same way. That gap predates this PR and is not widened here.ambient_strings::ambient_stringsrepeats its module path (ambient_strings.rs:15). Fixed in 5f3aab7: the function islocalized, called aslocalized(ctx, WidgetsLocalizations::back_button_label).The fixes are tests and a crate-private rename, so no second round was run on them.
Also after the read: 08793e0 adds the
typos.tomlentry described under Expectations. CI'schecksjob was red on 1046e26 because typos readAlleas a misspelling.https://claude.ai/code/session_01EqfW4DyGdFu4cM4nUks6cZ
Generated by Claude Code