Content-Length: 315894 | pFad | http://github.com/flutter/flutter/pull/171935

EF [Web] Implement disabling interactive selection by loic-sharma · Pull Request #171935 · flutter/flutter · GitHub
Skip to content

[Web] Implement disabling interactive selection #171935

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

Merged

Conversation

loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented Jul 10, 2025

This updates Flutter Web to ignore copy/paste/selections if enableInteractiveSelection is false in a text field.

Part of #157611

Scenarios tested

  1. Click/tap on text: cursor should not move.
  2. Double click/tap on text: text should not be selected
  3. Triple click/tap on text: text should not be selected
  4. Move cursor back (Left arrow): cursor should move back
  5. Move cursor forward (Right arrow): cursor should move forward
  6. Select previous word (Shift+Left arrow): text should not be selected, cursor moves to previous word
  7. Select previous word (Shift+Right arrow): text should not be selected, cursor moves the next word
  8. Select all shortcut (Ctrl+A or Apple+A): text should not be selected. ⚠️ With this fix, Flutter Web moves the cursor to the end of the text field.
  9. Copy shortcut (Ctrl+C or Apple+C): clipboard should not be updated
  10. Paste shortcut (Ctrl+V or Apple+V): clipboard should not be pasted
  11. Right-click > Copy: clipboard should not be updated
  12. Right-click > Paste: clipboard should not be pasted

Browsers tested

macOS: Chrome, Firefox, Safari

Example app

import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: TextField(
            enableInteractiveSelection: false,
          ),
        ),
      ),
    ),
  );
}

Pre-launch Checklist

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

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. platform-web Web applications specifically labels Jul 10, 2025
@loic-sharma loic-sharma requested a review from mdebbar July 11, 2025 00:13
@loic-sharma loic-sharma marked this pull request as ready for review July 11, 2025 00:13
@loic-sharma loic-sharma force-pushed the web_disable_interactive_interaction branch from 63f0e9d to 2ade87a Compare July 11, 2025 17:51
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing this!

Does this PR fully fix #157611 or is there something remaining?

@loic-sharma
Copy link
Member Author

loic-sharma commented Jul 11, 2025

Does this PR fully fix #157611 or is there something remaining?

It fixes all the issues for Flutter Web, yup. Here's the corresponding PR that landed to fix Flutter native platforms: #171050. I'll close that issue once this PR lands :)

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 11, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 11, 2025
Merged via the queue into flutter:master with commit 595bf3f Jul 11, 2025
177 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 11, 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 engine flutter/engine repository. See also e: labels. platform-web Web applications specifically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/flutter/flutter/pull/171935

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy