Skip to content

After inputting text into a textFormField tapping into a second TextFormField does not trigger onTapOutside  #127597

@Strain-solutions

Description

@Strain-solutions

Is there an existing issue for this?

Steps to reproduce

Using flutter web I have a listview with each item in the listview contains a textFormField. I use the onTapOutside to save the text that has been inputed to a repo. This works fine if the user taps the back button or most other places on the screen. However, if they tap into another textFormField then the onTapOutside does not trigger and the text is not stored. This is on web so using 'done' on the keyboard is not an option like it is on mobile.

Expected results

Tapping into another textformfield should trigger the onTapOutside callback (and save the text to the repo)

Actual results

Tapping into another textformfield does not trigger the onTapOutside callback (and text is not stored)

Code sample

Code sample
import 'package:flutter/material.dart';


class TestTextController extends StatefulWidget {
  const TestTextController({Key? key}) : super(key: key);

  @override
  State<TestTextController> createState() => _TestTextControllerState();
}

class _TestTextControllerState extends State<TestTextController> {
  TextEditingController tx1 = TextEditingController();
  TextEditingController tx2 = TextEditingController();



  @override
  Widget build(BuildContext context) {
    return  Scaffold(
      appBar: AppBar(title: Text('Test'),),
      body: SizedBox(
       width: 200,
        child: Column(
          children: [
            TextFormField(
              controller: tx1,
              decoration: InputDecoration(
                  focusColor: Colors.grey,
                  focusedBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(5.0)),
                      borderSide: BorderSide(color: Colors.blue)),
                  isCollapsed: false,
              ),
              // initialValue: "",
              onChanged: (text)=>print(text),
              onTapOutside: (event)=>print('tapped outside'),
              maxLines: null,
            ),
            TextFormField(
              controller: tx2,
              decoration: InputDecoration(
                  focusColor: Colors.grey,
                  focusedBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(5.0)),
                      borderSide: BorderSide(color: Colors.blue)),
                  isCollapsed: false,
              ),
              // initialValue: "",
              onChanged: (text)=>print(text),
              onTapOutside: (event)=>print('tapped outside'),
              maxLines: null,
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.11.0-6.0.pre.18, on macOS 12.6.4 21G526 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resources

• 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 problemsf: focusFocus traversal, gaining or losing focusfound in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions