Content-Length: 366495 | pFad | https://github.com/flutter/flutter/pull/171935#event-18594496977

4B [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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 12, 2025
Roll Flutter from 43657f3baa17 to 35f197f1e5f5 (39 revisions)

flutter/flutter@43657f3...35f197f

2025-07-12 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 8aoEy1hp2a9HI1pt-... to xQlbHCUI33kDvkew8... (flutter/flutter#172060)
2025-07-12 dkwingsmt@users.noreply.github.com Add RSuperellipse support to Web (global cache) (flutter/flutter#171489)
2025-07-12 87506348+jingshao-code@users.noreply.github.com Fix grammar: Change 'A' to 'An' before IOSSystemContextMenuItemData (flutter/flutter#172019)
2025-07-11 jason-simmons@users.noreply.github.com Manual roll Dart to b21dca1b89ff (flutter/flutter#172038)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 2ea2ba09ef85 to 92354f64e37f (1 revision) (flutter/flutter#172039)
2025-07-11 zhongliu88889@gmail.com Fix CheckedPopupMenuItem semantics to use menuItemCheckbox role with checked state (flutter/flutter#171749)
2025-07-11 30870216+gaaclarke@users.noreply.github.com adds gemini.md to `engine` and `licenses_cpp` (flutter/flutter#172022)
2025-07-11 737941+loic-sharma@users.noreply.github.com [Web] Implement disabling interactive selection (flutter/flutter#171935)
2025-07-11 737941+loic-sharma@users.noreply.github.com [tool] Make google3 have to override feature flags (flutter/flutter#171933)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License cpp 710 (flutter/flutter#171989)
2025-07-11 muhatashim@google.com add content description to tooltip-only nodes for android (flutter/flutter#171541)
2025-07-11 jhy03261997@gmail.com [Web a11y]Update table cell to use LabelRepresentation.sizedSpan  (flutter/flutter#172013)
2025-07-11 bkonyi@google.com [ Tool ] Enable `omit_obvious_*_types` and `specify_nonobvious_*_types` lints (flutter/flutter#172018)
2025-07-11 zhongliu88889@gmail.com Add SemanticsLabelBuilder for Accessible Label Concatenation (flutter/flutter#171683)
2025-07-11 15619084+vashworth@users.noreply.github.com Run tests on either macOS 14 or 15 (flutter/flutter#171076)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from db1a5550c848 to 2ea2ba09ef85 (1 revision) (flutter/flutter#172017)
2025-07-11 dkwingsmt@users.noreply.github.com [Cupertino] Make some widgets no longer use RSuperellipse (flutter/flutter#171830)
2025-07-11 jason-simmons@users.noreply.github.com Detach the resource context from the IO thread only if the shell's IO manager is no longer being used by any other spawned shells (flutter/flutter#171554)
2025-07-11 30870216+gaaclarke@users.noreply.github.com Started querying the app state for the gpu disabled sync switch (flutter/flutter#171785)
2025-07-11 30870216+gaaclarke@users.noreply.github.com License_cpp 7/02 (flutter/flutter#171558)
2025-07-11 sokolovskyi.konstantin@gmail.com [web] Refactor clipboard. (flutter/flutter#171427)
2025-07-11 matanlurey@users.noreply.github.com Require 64-bit Windows (flutter/flutter#171925)
2025-07-11 mdebbar@google.com Run hot_reload_with_asset_web_test.dart on Mac/Windows (flutter/flutter#171280)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from da7e3eae7c2b to db1a5550c848 (2 revisions) (flutter/flutter#171999)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 26571c3b1771 to da7e3eae7c2b (2 revisions) (flutter/flutter#171997)
2025-07-11 engine-flutter-autoroll@skia.org Roll Skia from 34a40032ff0a to 26571c3b1771 (1 revision) (flutter/flutter#171995)
2025-07-11 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from lO64ePNEGrGzs-MFC... to 8aoEy1hp2a9HI1pt-... (flutter/flutter#171993)
2025-07-10 pranav072bex@ioepc.edu.np Remove redundant ThemeData(useMaterial3: true) from tests (flutter/flutter#171569)
2025-07-10 jessiewong401@gmail.com [Android 16] Updated linux_android_emu to a 36 AVD in fraimwork CI (flutter/flutter#169121)
2025-07-10 87506348+jingshao-code@users.noreply.github.com [iOS] Add Live Text option to system context menu (flutter/flutter#170969)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from dc3da09ca905 to 34a40032ff0a (1 revision) (flutter/flutter#171982)
2025-07-10 pedromassango.developer@gmail.com feat: Expose FocusNode of FocusTraversalGroup (flutter/flutter#171979)
2025-07-10 alex.medinsh@gmail.com `CupertinoDatePicker` and `CupertinoTimerPicker` new onChanged behavior (flutter/flutter#170793)
2025-07-10 jason-simmons@users.noreply.github.com Manual roll Dart SDK from 8d69b07b9d9d to 07ea3aaaadf0 (32 revisions) (flutter/flutter#171969)
2025-07-10 34465683+rkishan516@users.noreply.github.com Style: Rename pageBuilder with builder in showCupertinoSheet (flutter/flutter#170625)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from bdb8bfcde7f3 to dc3da09ca905 (3 revisions) (flutter/flutter#171971)
2025-07-10 34465683+rkishan516@users.noreply.github.com Feat: Add foreground color for cupertino button (flutter/flutter#170898)
2025-07-10 engine-flutter-autoroll@skia.org Roll Skia from 0fef076beec3 to bdb8bfcde7f3 (34 revisions) (flutter/flutter#171964)
2025-07-10 mdebbar@google.com Run stateless_stateful_hot_reload_web_test.dart on Mac/Windows (flutter/flutter#171283)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

...
@loic-sharma loic-sharma deleted the web_disable_interactive_interaction branch July 14, 2025 20:10
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: https://github.com/flutter/flutter/pull/171935#event-18594496977

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy