-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamTriaged by Text Input team
Description
Steps to reproduce
I’m having trouble disabling text copying in a TextField using Flutter. Even though I’ve set enableInteractiveSelection to false and customized the context menu, it’s still possible to copy the text using keyboard shortcuts. When I use Cmd + A to select all the text (even though there’s no visual indication of the selection), I can still copy the entire content of the TextField with Cmd + C. This behavior goes against the expected outcome of completely disabling text copying: Flutter API Reference.
Expected results
When enableInteractiveSelection is set to false, the TextField should not allow any text selection or copying, whether through the context menu or keyboard shortcuts.
Actual results
Text can still be copied using Cmd + A followed by Cmd + C.
Code sample
Code sample
TextField(
decoration: const InputDecoration(
border: OutlineInputBorder(),
),
// disable context menu
contextMenuBuilder: (_, __) => const SizedBox.shrink(),
enableInteractiveSelection: false, // disable copy paste
),
),Screenshots or Video
Screenshots / Video demonstration
flutter_issue.mp4
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64, locale zh-Hans-CN)
• Flutter version 3.24.3 on channel stable at /Users/jhlee0133/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (6 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/jhlee0133/Library/Android/sdk
• Platform android-34-ext8, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2)
• 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 17.0.9+0-17.0.9b1087.7-11185874)
[✓] Android Studio (version 2023.1)
• Android Studio at /Volumes/macOS Ventura/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 17.0.7+0-17.0.7b1000.6-10550314)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
• IntelliJ at /Users/jhlee0133/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8109.175/IntelliJ IDEA.app
• 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
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.3)
• IntelliJ at /Users/jhlee0133/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/242.23339.11/IntelliJ IDEA.app
• 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
[✓] VS Code (version 1.93.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.96.0
[✓] Connected device (4 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0.1 24A348 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.70
[✓] Network resources
• All expected network resources are available.
• No issues found!d3xt3r2909 and Umair-Manzoor-47
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsfound in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input teamOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamTriaged by Text Input team