Skip to content

[PWA] Duplicate “Copy” action shown when SelectionArea wraps — double copy menu #175114

Closed

Description

@Bolide9

Steps to reproduce

  1. Create a new Flutter app (flutter create).
  2. Replace lib/main.dart with the snippet below.
  3. Run on Web (PWA or plain web):
  4. flutter run -d web-server
  5. Open server with emulator
  6. Select the text via mouse drag (or long-press on touch).
  7. Observe the context/selection actions contain two “Copy” entries.

Expected results

Only one “Copy” action appears in the selection controls / context menu.

Actual results

Two “Copy” actions are shown for the same selection on PWA

Code sample

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

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

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

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: Scaffold(
      appBar: AppBar(title: const Text('ListView with SelectionArea')),
      body: ListView.builder(
        itemCount: 20,
        itemBuilder:
            (context, index) => SelectionArea(
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text(
                  'Item ${index + 1}',
                  style: const TextStyle(fontSize: 18),
                ),
              ),
            ),
      ),
    ),
  );
}

Screenshots or Video

Video demonstration PWA [BUG, not working properly]
Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-09-09.at.11.12.17.mp4
Video demonstration IOS [works fine]
Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-09-09.at.11.10.23.mp4

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.3, on macOS 15.6.1 24G90 darwin-arm64, locale ru-RU) [259ms]
    • Flutter version 3.35.3 on channel stable at /Users/maga/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a402d9a437 (5 days ago), 2025-09-03 14:54:31 -0700
    • Engine revision ddf47dd3ff
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1 187ms]
    • Android SDK at /Users/maga/Library/Android/sdk
    • Emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /opt/homebrew/Cellar/openjdk@17/17.0.15/libexec/openjdk.jdk/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [806ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [8ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] VS Code (version 1.103.2) [6ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.118.0

[✓] Connected device (3 available) [5,9s]
    • iPhone 16 Plus (mobile) • 667BE1F0-E3BD-455A-A6CA-603D3560D8E9 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-6 (simulator)
    • macOS (desktop)         • macos                                • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 139.0.7258.155

[✓] Network resources [366ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. tirth-patel-nc commented on Sep 9, 2025

    @tirth-patel-nc
    Member

    Thanks for the report. Seeing the same behaviour with latest SDK versions on Web (iOS). Tested on Safari.

    Chrome on android appears to work fine.

    stable : 3.35.3
    master : 3.37.0-1.0.pre-57
    
  2. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIs
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    platform-webWeb applications specifically
    team-webOwned by Web platform team
    c: parityWorks on one platform but not another
    and removed
    in triagePresently being triaged by the triage team
    on Sep 9, 2025
  3. mdebbar commented on Oct 1, 2025

    @mdebbar
    Contributor

    This is likely a browser context menu + flutter context menu showing up.

    We've always had the flutter context menu disabled on web, but I think that was done in an era where all text selection was handled in EditableText:

    if (_webContextMenuEnabled) {
    return false;
    }

    Now we have more places that show a toolbar. Some of them skip toolbar on the web, e.g:

    if (kIsWeb && BrowserContextMenu.enabled) {
    return false;
    }

    But some of them don't:

    _selectionOverlay!.showToolbar();

    I haven't confirmed that this is the callsite that's causing the bug, but looking at the video I see the flutter toolbar shows up when handle drag is complete. So I strongly suspect this is culprit.

    Is there a better way to solve this once and for all? cc @loic-sharma @Renzo-Olivares

  4. added
    fyi-webFor the attention of Web platform team
    triaged-webTriaged by Web platform team
    and removed
    team-webOwned by Web platform team
    fyi-text-inputFor the attention of Text Input team
    on Oct 1, 2025
  5. added
    P1High-priority issues at the top of the work list
    on Oct 9, 2025
  6. added a commit that references this issue on Oct 16, 2025
    666634b
  7. github-actions commented on Oct 30, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Oct 30, 2025
  9. added a commit that references this issue on Dec 10, 2025
    83ae4c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listbrowser: safari-iosonly manifests in Safari on iOSc: parityWorks on one platform but not anotherf: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions