Skip to content

TextField Becomes Unresponsive After Using Backswipe Gesture #146844

@b3nni97

Description

@b3nni97

Steps to reproduce

  1. Start the minimal reproducible sample.
  2. Tap on "Open page" to navigate to the second page.
  3. Return to the main page by using the Backswipe Gesture.
  4. Try to focus on the text field; the keyboard should not open.

I have bisected this issue to PR #144207 @LongCatIsLooong.

Expected results

The text field should be focusable and the keyboard should appear when the text field is tapped.

Actual results

The text field is not focusable and the keyboard does not appear.

Code sample

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text("Main page"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Padding(
              padding: EdgeInsets.all(24),
              child: TextField(
                autofocus: false,
              ),
            ),
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(builder: (context) => const SecondPage()),
                );
              },
              child: const Text("Open page"),
            ),
          ],
        ),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: const Text("Second page"),
          leading: IconButton(
            onPressed: () {
              Navigator.pop(context);
            },
            icon: const Icon(Icons.arrow_back),
          )),
      body: const Center(
        child: Text("This is the second page!"),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
RPReplay_Final1713298246.MP4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
 Flutter (Channel master, 3.22.0-11.0.pre.22, on macOS 14.0 23A344 darwin-arm64, locale en-US)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowf: cupertinoflutter/packages/flutter/cupertino repositoryf: focusFocus traversal, gaining or losing focusf: routesNavigator, Router, and related APIs.found in release: 3.22Found to occur in 3.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions