Skip to content

[web] onSubmitted of TextField invoked if another TextField is clicked #49785

@a-marenkov

Description

@a-marenkov

In browsers onSubmitted of TextField invoked on Enter and if another TextField is clicked.

Expected:

  • on Enter clicked - onSubmitted invocation;
  • on another TextField clicked - only focus change (without onSubmitted invocation).

Steps to Reproduce

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      padding: const EdgeInsets.all(24.0),
      child: Material(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextField(
              decoration: InputDecoration(hintText: 'TextField #1'),
              onSubmitted: (text) {
                print('TextField #1 onSubmitted: $text');
              },
            ),
            TextField(
              decoration: InputDecoration(hintText: 'TextField #2'),
              onSubmitted: (text) {
                print('TextField #2 onSubmitted: $text');
              },
            ),
          ],
        ),
      ),
    );
  }
}

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.13.6, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2019.2)
[✓] Connected device (3 available)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions