Skip to content

AutofillGroup does not autofill all related fields in semantics mode #180652

Closed

Description

@Umar888

Issue Detail

When using AutofillGroup with multiple related input fields, autofill only populates the initially focused field. Other fields within the same AutofillGroup are not automatically filled, even when they have valid autofill hints and are expected to be completed together by the platform.

Steps to reproduce

  1. Save form data on the device (any multi-field form)
  2. Open the app and focus on one field
  3. Select an autofill suggestion
  4. Observe that only the focused field is populated

Expected results

When selecting an autofill suggestion:

All relevant fields within the same AutofillGroup should be autofilled

Autofill should behave consistently with native platform expectations

Actual results

Only the currently focused field is autofilled

Other fields inside the same AutofillGroup remain empty

User must manually enter remaining values or click on each field to auto fill remaining fields in same

Code sample

Code sample
AutofillGroup(
  child: Column(
    children: [
      TextFormField(
        autofillHints: const [
          AutofillHints.username,
        ],
        decoration: const InputDecoration(
          labelText: 'Field A',
        ),
      ),
      const SizedBox(height: 16),
      TextFormField(
        autofillHints: const [
          AutofillHints.password,
        ],
        obscureText: true,
        decoration: const InputDecoration(
          labelText: 'Field B',
        ),
        onFieldSubmitted: (_) {
          TextInput.finishAutofillContext();
        },
      ),
    ],
  ),
);

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.5, on macOS 14.7.6 23H626 darwin-arm64, locale en-NL) [820ms]
    • Flutter version 3.35.5 on channel stable at /Users/umarghaffarold/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ac4e799d23 (3 months ago), 2025-09-26 12:05:09 -0700
    • Engine revision d3d45dcf25
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[!] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [7.6s]
    • Android SDK at /Users/umarghaffarold/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.1.0-rc1
    • ANDROID_HOME = /Users/umarghaffarold/Library/Android/sdk
    • Java binary at: /Users/umarghaffarold/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [2.2s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [9ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [8ms]
    • Android Studio at /Users/umarghaffarold/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)

[✓] Connected device (2 available) [6.8s]
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.7.6 23H626 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 143.0.7499.192
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [1,197ms]
    • All expected network resources are available.

<!-- Failed to upload "Untitled.mp4" -->

Activity

  1. fayzan101 commented on Jan 7, 2026

    @fayzan101

    This is expected behavior on Flutter (especially on Android). Currently, AutofillGroup only autofills the focused field. Other fields in the group are not automatically filled due to platform limitations.

    Workarounds:

    Ensure correct autofillHints are set for all fields.

    Call TextInput.finishAutofillContext() after the last field.

    On Android, you may need to manually propagate values to other fields if full autofill is required.

    Upgrading Flutter to the latest stable version may improve multi-field autofill behavior.

  2. Umar888 commented on Jan 8, 2026

    @Umar888
    Author

    It is happening on flutter web for me right now, also added TextInput.finishAutofillContext() after last field, but no success

  3. darshankawar commented on Jan 9, 2026

    @darshankawar
    Member

    @Umar888 Since you mentioned that the reported behavior is occuring on web for you, please check if this resembles your case or not.

  4. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 9, 2026
  5. Umar888 commented on Jan 10, 2026

    @Umar888
    Author

    @Umar888 Since you mentioned that the reported behavior is occuring on web for you, please check if this resembles your case or not.

    No, because on my local autofill is working fine. But when we release, on browser auto fill is not working

  6. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 10, 2026
  7. darshankawar commented on Jan 12, 2026

    @darshankawar
    Member

    Keeping issue open and labeling for team's tracking.

  8. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    a: text inputEntering text in a text field or keyboard related problems
    platform-webWeb applications specifically
    a: releaseChallenges faced when attempting to productionize an app
    fyi-webFor the attention of Web platform team
    and removed
    in triagePresently being triaged by the triage team
    on Jan 12, 2026
  9. 9 remaining items

  10. Umar888 commented on Jan 16, 2026

    @Umar888
    Author

    @flutter-zl , can you please try on Flutter (Channel stable, 3.35.5)
    This is my application URL where I deployed : https://dev.dashboard.knipklok.nl/shop/login

  11. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 16, 2026
  12. Umar888 commented on Jan 16, 2026

    @Umar888
    Author

    @flutter-zl this is my code sample, I am using

    AutofillGroup(
      key: controller.autoFillKey,
      child: Column(
        children: [
          CustomTextField(
            isRequired: true,
            autoFocus: true,
            fieldName: LocaleKeys.emailAddress.tr(),
            minLength: CharLimits.emailAddressMin,
            maxLength: CharLimits.emailAddressMax,
            hintText: LocaleKeys.hintEmailAddress.tr(),
            autofillHints: const [
              AutofillHints.username,
              AutofillHints.email,
            ],
            inputType: TextInputType.emailAddress,
            controller: controller.emailController,
            validator: (String value) {
              if (value.trim().isEmpty) {
                return LocaleKeys.errorFieldIsRequired(
                  LocaleKeys.emailAddress.tr(),
                );
              }
              return Validators.validateEmail(value);
            },
          ),
          const SizedBox(height: Dimens.spacingNormal),
          PasswordInputField(
            isRequired: true,
            fieldName: LocaleKeys.password.tr(),
            hintText: LocaleKeys.hintPassword.tr(),
            inputType: TextInputType.text,
            controller: controller.passwordController,
            onEditingComplete: () {
              TextInput.finishAutofillContext();
            },
            validator: (String value) {
              if (value.trim().isEmpty) {
                return LocaleKeys.errorFieldIsRequired(
                  LocaleKeys.password.tr(),
                );
              }
              // Removed password validation from login
              // Only required for set password screen
              return null;
            },
            onFieldSubmitted: (value) {
              TextInput.finishAutofillContext();
              controller.submitForm(widget.redirect);
            },
          ),
        ],
      ),
    );
    
    

    Then this is password input field class

    class _PasswordInputFieldState extends State<PasswordInputField> {
      var _isPasswordVisible = false;
    
      @override
      Widget build(BuildContext context) {
        final theme = Theme.of(context);
        return CustomTextField(
          isRequired: widget.isRequired,
          inputFieldKey: widget.inputFieldKey,
          obscureText: !_isPasswordVisible,
          onEditingComplete: widget.onEditingComplete,
          bottomSpacing: 0,
          fieldName: widget.fieldName,
          hintText: widget.hintText,
          autofillHints: const [AutofillHints.password],
          textColor: theme.colorScheme.onPrimaryContainer,
          inputType: TextInputType.visiblePassword,
          controller: widget.controller,
          validator: widget.validator,
          onFieldSubmitted: (value) {
            widget.onFieldSubmitted?.call(value);
          },
          suffix: InkWell(
            onTap: () => setState(() {
              _isPasswordVisible = !_isPasswordVisible;
            }),
            child: CommonImage(
              _isPasswordVisible ? Resources.icInVisible : Resources.icVisible,
            ),
          ),
        );
      }
    }
    
  13. Umar888 commented on Jan 21, 2026

    @Umar888
    Author

    I switched to master channel, but it is not working in my case

  14. flutter-zl commented on Jan 21, 2026

    @flutter-zl
    Contributor

    I can confirm that It is not working when semantic is enabled.

  15. Umar888 commented on Jan 21, 2026

    @Umar888
    Author

    @flutter-zl after disabling semantics it is still no working

    AutofillGroup( key: controller.autoFillKeyB, child: Column( mainAxisSize: MainAxisSize.min, children: [ ExcludeSemantics( child: TextFormField( autofillHints: const [ AutofillHints.username, ], controller: controller.mixedEmailController, decoration: const InputDecoration( labelText: 'Field A', ), ), ), const SizedBox(height: 16), ExcludeSemantics( child: TextFormField( autofillHints: const [ AutofillHints.password, ], controller: controller.mixedPasswordController, obscureText: true, decoration: const InputDecoration( labelText: 'Field B', ), onFieldSubmitted: (_) { TextInput.finishAutofillContext(); }, ), ), ], ), )

  16. flutter-zl commented on Jan 21, 2026

    @flutter-zl
    Contributor

    @Umar888 , in your app, have you enabled semantic in your main function? the auto fill works if SemanticsBinding.instance.ensureSemantics() is deleted.

    import 'package:flutter/semantics.dart';

    void main() {
    runApp(const MyApp());
    SemanticsBinding.instance.ensureSemantics();
    }

  17. Umar888 commented on Jan 21, 2026

    @Umar888
    Author

    @flutter-zl no I didn't add anything like this

    SemanticsBinding.instance.ensureSemantics();

  18. flutter-zl commented on Jan 21, 2026

    @flutter-zl
    Contributor

    @flutter-zl no I didn't add anything like this

    SemanticsBinding.instance.ensureSemantics();

    Please check https://flutter-demo-06-before.web.app/.
    The autofill works for both fields when SemanticsBinding.instance.ensureSemantics() is not added.
    If I add it, the issue occurs.

  19. yjbanov commented on Apr 28, 2026

    @yjbanov
    Contributor

    Just a bit of background. We never really implemented group form autofill in semantics mode (there was an attempt but it never got over the finish line). So this needs to be implemented.

  20. changed the title [-]AutofillGroup does not autofill all related fields[/-] [+]AutofillGroup does not autofill all related fields in semantics mode[/+] on Apr 28, 2026
  21. added a commit that references this issue on Jul 31, 2026
    031c6b8
  22. github-actions commented on Aug 14, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  23. locked as resolved and limited conversation to collaborators on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: releaseChallenges faced when attempting to productionize an appa: text inputEntering text in a text field or keyboard related problemsengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specificallyteam-webOwned by Web platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions