Skip to content

[iOS] System context menu does not reappear when a scroll ends involving TextField #185230

Description

@Renzo-Olivares

Steps to reproduce

  1. Run code sample on the iOS simulator or physical iPhone on iOS 16.0+ where the system context menu is supported.
  2. Tap on the field to focus it.
  3. Double tap a word to select it and reveal the context menu.
  4. Try a short or long scroll, but when finishing the scroll keep the selection in the view.

Expected results

Double tap a word to select it and show the context menu and then scrolling hides the context menu, and when the scroll ends and the selection is in view then the context menu reappears.

Screen.Recording.2026-04-17.at.6.19.03.PM.mov

Actual results

Double tap a word to select it and show the context menu and then scrolling hides the context menu, but the menu never reappears when the scroll finishes.

Screen.Recording.2026-04-17.at.6.08.11.PM.mov

What is happening

Using the system context menu on iOS the platform automatically hides the menu when a tap happens outside of it. In the scrolling scenario when initiating a scroll the menu is hidden immediately by the platform. This immediately causes EditableText to discard any scroll listeners so we never hit the required logic that handles the context menu behavior during scroll a scroll.

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(
      home: Scaffold(
        appBar: AppBar(title: const Text('Selection Handles Scroll Demo')),
        body: CustomScrollView(
          slivers: [
            SliverToBoxAdapter(
              child: Container(
                height: 2000,
                padding: const EdgeInsets.all(16.0),
                child: TextField(
                  maxLines: null,
                  controller: TextEditingController(
                    text:
                        'Select some text at the top of this field, then scroll down to see the handles smoothly fade out as they leave the viewport!\n\n${'Line of text to make it long...\n' * 50}',
                  ),
                  decoration: const InputDecoration(
                    border: OutlineInputBorder(),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

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 problemsc: regressionIt was better in the past than it is nowteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions