Skip to content

[VPAT] Declare input purpose on a11y_assessments text fields - #13243

Merged
auto-submit[bot] merged 7 commits into
flutter:mainfrom
flutter-zl:vpat-a11y-assessments-text-fields
Oct 16, 2026
Merged

auto-submit[bot] merged 7 commits into
flutter:mainfrom
flutter-zl:vpat-a11y-assessments-text-fields

Conversation

@flutter-zl

@flutter-zl flutter-zl commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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 render autocomplete="on". The email demo uses maxLines: null, which makes the field a <textarea>, and the engine always writes autocomplete="off" on those. Neither demo sets autofillHints.

Fix

The email fields are now single-line with keyboardType: TextInputType.emailAddress and autofillHints: [AutofillHints.email], so they render <input autocomplete="email">. The @gmail.com suffix and its Semantics wrapper are removed, since autofill would produce foo@gmail.com@gmail.com. hintMaxLines: 3 keeps 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 renders autocomplete="current-password" once focused. Unfocused and disabled password fields still render autocomplete="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.

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 13, 2026
@flutter-zl
flutter-zl marked this pull request as ready for review October 13, 2026 22:20
@flutter-zl flutter-zl added the CICD Run CI/CD label Oct 13, 2026

@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 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,

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

Suggested change
hintMaxLines: 3,
hintMaxLines: 5,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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,

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

Suggested change
hintMaxLines: 3,
hintMaxLines: 5,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to 3 in description section.

key: Key('enabled text field'),
maxLines: null,
keyboardType: TextInputType.emailAddress,
autofillHints: <String>[AutofillHints.email],

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

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.

Suggested change
autofillHints: <String>[AutofillHints.email],
autofillHints: [AutofillHints.email],
References
  1. Omit type arguments on generic collection literals when they can be inferred from the context. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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],

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

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.

Suggested change
autofillHints: const <String>[AutofillHints.email],
autofillHints: const [AutofillHints.email],
References
  1. Omit type arguments on generic collection literals when they can be inferred from the context. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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],

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

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.

Suggested change
autofillHints: <String>[AutofillHints.password],
autofillHints: [AutofillHints.password],
References
  1. Omit type arguments on generic collection literals when they can be inferred from the context. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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],

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

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.

Suggested change
autofillHints: <String>[AutofillHints.password],
autofillHints: [AutofillHints.password],
References
  1. Omit type arguments on generic collection literals when they can be inferred from the context. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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());

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

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.

Suggested change
await pumpsUseCase(tester, TextFieldPasswordUseCase());
await pumpsUseCase(tester, TextFieldPasswordUseCase());\n await tester.pumpAndSettle();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@flutter-zl flutter-zl changed the title [material_ui] Declare input purpose on a11y_assessments text fields [VPAT] Declare input purpose on a11y_assessments text fields Oct 14, 2026
@flutter-zl
flutter-zl requested a review from mdebbar October 14, 2026 17:49
key: Key('enabled text field'),
maxLines: null,
keyboardType: TextInputType.emailAddress,
autofillHints: <String>[AutofillHints.email],

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.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@flutter-zl flutter-zl added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2026
@auto-submit
auto-submit Bot merged commit 0563606 into flutter:main Oct 16, 2026
13 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 19, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD 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.

2 participants