Repository navigation
[VPAT] Declare input purpose on a11y_assessments text fields - #13243
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds autofill hints and input types to email and password text fields, along with corresponding widget tests to verify these accessibility improvements. The review feedback suggests increasing hintMaxLines from 3 to 5 for better wrapping at large text scales, omitting redundant <String> type arguments on the autofillHints collection literals, and adding await tester.pumpAndSettle() in the password field test to ensure the widget tree is fully built before querying.
| hintText: 'Enter your email', | ||
| // The field is single-line, so let the hint wrap at large | ||
| // text scales, one line per word. | ||
| hintMaxLines: 3, |
There was a problem hiding this comment.
The PR description states that hintMaxLines: 5 is used to keep the hint wrapping at large text scales. However, the implementation uses hintMaxLines: 3. Consider changing this to 5 to align with the description and ensure sufficient headroom for wrapping at very large text scales, or update the PR description if 3 was chosen intentionally.
| hintMaxLines: 3, | |
| hintMaxLines: 5, |
There was a problem hiding this comment.
Updated to 3 in description section.
| hintText: 'Enter your email', | ||
| // The field is single-line, so let the hint wrap at large | ||
| // text scales, one line per word. | ||
| hintMaxLines: 3, |
There was a problem hiding this comment.
The PR description states that hintMaxLines: 5 is used to keep the hint wrapping at large text scales. However, the implementation uses hintMaxLines: 3. Consider changing this to 5 to align with the description and ensure sufficient headroom for wrapping at very large text scales, or update the PR description if 3 was chosen intentionally.
| hintMaxLines: 3, | |
| hintMaxLines: 5, |
There was a problem hiding this comment.
Updated to 3 in description section.
| key: Key('enabled text field'), | ||
| maxLines: null, | ||
| keyboardType: TextInputType.emailAddress, | ||
| autofillHints: <String>[AutofillHints.email], |
There was a problem hiding this comment.
According to the Dart style guide, type arguments on collection literals should be omitted when they can be inferred from the context. Since autofillHints expects an Iterable<String>?, the <String> type argument is redundant.
| autofillHints: <String>[AutofillHints.email], | |
| autofillHints: [AutofillHints.email], |
References
- Omit type arguments on generic collection literals when they can be inferred from the context. (link)
There was a problem hiding this comment.
Keeping the explicit to match the surrounding code, which uses explicit collection types throughout ([...]), and existing material_ui usage such as autofillHints: const [...] in text_form_field_test.dart.
| key: const Key('disabled text field'), | ||
| maxLines: null, | ||
| keyboardType: TextInputType.emailAddress, | ||
| autofillHints: const <String>[AutofillHints.email], |
There was a problem hiding this comment.
According to the Dart style guide, type arguments on collection literals should be omitted when they can be inferred from the context. Since autofillHints expects an Iterable<String>?, the <String> type argument is redundant.
| autofillHints: const <String>[AutofillHints.email], | |
| autofillHints: const [AutofillHints.email], |
References
- Omit type arguments on generic collection literals when they can be inferred from the context. (link)
There was a problem hiding this comment.
Keeping the explicit to match the surrounding code, which uses explicit collection types throughout ([...]), and existing material_ui usage such as autofillHints: const [...] in text_form_field_test.dart.
| children: const <Widget>[ | ||
| TextField( | ||
| key: Key('enabled password'), | ||
| autofillHints: <String>[AutofillHints.password], |
There was a problem hiding this comment.
According to the Dart style guide, type arguments on collection literals should be omitted when they can be inferred from the context. Since autofillHints expects an Iterable<String>?, the <String> type argument is redundant.
| autofillHints: <String>[AutofillHints.password], | |
| autofillHints: [AutofillHints.password], |
References
- Omit type arguments on generic collection literals when they can be inferred from the context. (link)
There was a problem hiding this comment.
Keeping the explicit to match the surrounding code, which uses explicit collection types throughout ([...]), and existing material_ui usage such as autofillHints: const [...] in text_form_field_test.dart.
| ), | ||
| TextField( | ||
| key: Key('disabled password'), | ||
| autofillHints: <String>[AutofillHints.password], |
There was a problem hiding this comment.
According to the Dart style guide, type arguments on collection literals should be omitted when they can be inferred from the context. Since autofillHints expects an Iterable<String>?, the <String> type argument is redundant.
| autofillHints: <String>[AutofillHints.password], | |
| autofillHints: [AutofillHints.password], |
References
- Omit type arguments on generic collection literals when they can be inferred from the context. (link)
There was a problem hiding this comment.
Keeping the explicit to match the surrounding code, which uses explicit collection types throughout ([...]), and existing material_ui usage such as autofillHints: const [...] in text_form_field_test.dart.
| }); | ||
|
|
||
| testWidgets('password fields expose their input purpose', (WidgetTester tester) async { | ||
| await pumpsUseCase(tester, TextFieldPasswordUseCase()); |
There was a problem hiding this comment.
To ensure the widget tree is fully built and settled before querying widgets or semantics, it is recommended to call await tester.pumpAndSettle() after pumping the use case, similar to how it is done in text_field_test.dart.
| await pumpsUseCase(tester, TextFieldPasswordUseCase()); | |
| await pumpsUseCase(tester, TextFieldPasswordUseCase());\n await tester.pumpAndSettle(); |
There was a problem hiding this comment.
The test only reads EditableText.autofillHints, which is set once pumpWidget builds the tree, so there's nothing to settle. The other tests in this file query right after pumpsUseCase too. The email test settles because it checks semantics.
| key: Key('enabled text field'), | ||
| maxLines: null, | ||
| keyboardType: TextInputType.emailAddress, | ||
| autofillHints: <String>[AutofillHints.email], |
There was a problem hiding this comment.
With the @gmail.com suffix, autofilling an email will show foo@gmail.com@gmail.com. Should we drop the suffix from these two fields, or is the suffix part of what this use case is meant to assess?
There was a problem hiding this comment.
Good catch, I reproduced it. Dropped the suffix in 0675f4b: a fixed suffix means the field only takes the part before the @, which conflicts with autocomplete="email". #/text-form-field has the same pattern, so I'll clean that up separately.
…er#194745) flutter/packages@93eede7...10a178c 2026-10-19 47866232+chunhtai@users.noreply.github.com [material_ui] Fixes SearchAnchor and SearchBar semantics (flutter/packages#12680) 2026-10-17 tarrinneal@gmail.com [shared_preferences] switch to ffi/jni pigeon (flutter/packages#12329) 2026-10-17 22373191+Hari-07@users.noreply.github.com [in_app_purchase_storekit] Add show manage subscriptions path (flutter/packages#12454) 2026-10-17 ahmedsameha1@gmail.com [material_ui] Fix installing command material UI (flutter/packages#13135) 2026-10-16 magder@google.com [file_selector_ios] Drop deprecated UIDocumentPickerMode code path (flutter/packages#13292) 2026-10-16 magder@google.com [camera_avfoundation] Fixes sendability mismatch in completion handler (flutter/packages#13298) 2026-10-16 magder@google.com [local_auth_darwin] Fix Swift 6 concurrency analyzer errors from lifecycle delegate methods (flutter/packages#13296) 2026-10-16 magder@google.com [pointer_interceptor_ios] Use 'let' for unmutated var (flutter/packages#13297) 2026-10-16 magder@google.com [image_picker_ios] Fix Swift warnings in ImagePickerPluginTests (flutter/packages#13299) 2026-10-16 41930132+hellohuanlin@users.noreply.github.com [camera]delete fake bitrate/fps integration tests (flutter/packages#13291) 2026-10-16 magder@google.com [google_maps_flutter_ios] Use 'let' for unmutated var (flutter/packages#13300) 2026-10-16 zhongliu88889@gmail.com [VPAT] Declare input purpose on a11y_assessments text fields (flutter/packages#13243) 2026-10-16 50643541+Mairramer@users.noreply.github.com [cupertino_ui] Fix CupertinoMagnifier focalPointOffset animation scaling (flutter/packages#13118) 2026-10-16 mdebbar@google.com [tool] Exempt `test_apps/` from version and changelog checks (flutter/packages#13255) 2026-10-16 rmolivares@renzo-olivares.dev [material_ui] Fallback theme follows platform cherry pick (flutter/packages#13278) 2026-10-16 engine-flutter-autoroll@skia.org Roll Flutter from 5c7e45a to a3d71d8 (26 revisions) (flutter/packages#13290) 2026-10-16 41930132+hellohuanlin@users.noreply.github.com [camera]do not sleep to avoid hang due to merged thread (flutter/packages#13289) 2026-10-16 41930132+hellohuanlin@users.noreply.github.com [camera]fix camera failure due to wrong jpg extension (flutter/packages#13285) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Problem
The a11y_assessments text field demos do not declare their input purpose, so on web the email fields render
autocomplete="off"and the password fields renderautocomplete="on". The email demo usesmaxLines: null, which makes the field a<textarea>, and the engine always writesautocomplete="off"on those. Neither demo setsautofillHints.Fix
The email fields are now single-line with
keyboardType: TextInputType.emailAddressandautofillHints: [AutofillHints.email], so they render<input autocomplete="email">. The@gmail.comsuffix and itsSemanticswrapper are removed, since autofill would producefoo@gmail.com@gmail.com.hintMaxLines: 3keeps the hint wrapping at large text scales, and the 3x-scale test now checks for ellipsis at 320px instead of a fixed height.The password fields get
autofillHints: [AutofillHints.password], which rendersautocomplete="current-password"once focused. Unfocused and disabled password fields still renderautocomplete="off", because autofill hints are not in the semantics tree. That needs an engine change.Demo
Run the test app on web and inspect the text inputs on #/text-field and #/text-field-password, before and after focusing them.