Skip to content

TextField magnifier gets stuck on screen when long press is cancelled #167879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
O-Hannonen opened this issue Apr 26, 2025 · 2 comments · Fixed by #167881
Closed

TextField magnifier gets stuck on screen when long press is cancelled #167879

O-Hannonen opened this issue Apr 26, 2025 · 2 comments · Fixed by #167881
Labels
a: text input Entering text in a text field or keyboard related problems found in release: 3.29 Found to occur in 3.29 found in release: 3.32 Found to occur in 3.32 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team

Comments

@O-Hannonen
Copy link
Contributor

Steps to reproduce

  1. Long press TextField to open magnifier
  2. While still long pressing, put the app to background with another finger (-> cancel long press)
  3. Open the app again

Expected results

Magnifier should close, similarly to when the long press ends (without cancelling)

Actual results

Magnifier is stuck on the screen, even if you scroll away from the textfield

Code sample

Example code
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: 'Magnifier bug',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Magnifier bug'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: ListView(
        children: [
          const Text(
            "Long press to trigger the magnifier and while holding down, put the app into background. When coming back to app, the magnifier should be stuck on screen.",
          ),
           TextField(
            decoration: InputDecoration(hintText: "write something"),
          ),
          ...List.generate(
            20,
            (i) => GestureDetector(
                onTap: (){
              FocusScope.of(context).unfocus();
            },
              child: Container(
                height: 50,
                width: double.infinity,
                color: i % 2 == 0 ? Colors.red : Colors.blue,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
ScreenRecording_04-26-2025.12-50-31_1.MP4

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]
@VB10
Copy link
Contributor

VB10 commented Apr 27, 2025

I looked at your PR, and it appears to fix this issue. Thank you, @O-Hannonen

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 28, 2025
@darshankawar
Copy link
Member

Thanks for the report and potential fix. Seeing the same behavior on latest sdk versions.

stable : 3.29.3
master : 3.32.0-1.0.pre.276

@darshankawar darshankawar added a: text input Entering text in a text field or keyboard related problems has reproducible steps The issue has been confirmed reproducible and is ready to work on team-text-input Owned by Text Input team found in release: 3.29 Found to occur in 3.29 found in release: 3.32 Found to occur in 3.32 and removed in triage Presently being triaged by the triage team labels Apr 28, 2025
@justinmc justinmc added P2 Important issues not at the top of the work list triaged-text-input Triaged by Text Input team labels May 1, 2025
github-merge-queue bot pushed a commit that referenced this issue May 16, 2025
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

## Fixes #167879

This PR fixes bug where magnifier and floating cursor get stuck on
screen when long press is cancelled (eg. by closing the app).

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems found in release: 3.29 Found to occur in 3.29 found in release: 3.32 Found to occur in 3.32 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy