Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented May 21, 2025

Goes back to using the Flutter-drawn context menu for SelectableText. Currently, SystemContextMenu requires an active text input connection to work. This snuck in because SelectableText is based on EditableText.

Fixes #169001

@justinmc justinmc self-assigned this May 21, 2025
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 21, 2025
@justinmc
Copy link
Contributor Author

@justinmc justinmc marked this pull request as ready for review May 21, 2025 22:22
@justinmc justinmc requested a review from Renzo-Olivares May 21, 2025 22:23
group('context menu', () {
// Regression test for https://github.com/flutter/flutter/issues/169001.
testWidgets(
'iOS uses the system context menu by default if supported',
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should this change to iOS does not use the system context menu by default on SelectableText if supported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

@Renzo-Olivares Renzo-Olivares left a comment

Choose a reason for hiding this comment

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

LGTM w/ small nit.

@justinmc justinmc added the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2025
@auto-submit auto-submit bot added this pull request to the merge queue May 30, 2025
Merged via the queue into flutter:master with commit 1677233 May 30, 2025
76 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 30, 2025
@justinmc justinmc deleted the selectable-text-system-context-menu branch May 30, 2025 19:36
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 31, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 5, 2025
@ezamagni-tg
Copy link

@Renzo-Olivares @justinmc any chance this could be cherry picked into stable?

github-merge-queue bot pushed a commit that referenced this pull request Jul 17, 2025
When readOnly is true, there is no TextInputConnection, so the
SystemContextMenu can't be shown. Instead, this shows the Flutter-drawn
context menu.

This video shows the change. You can slightly tell that the system
context menu is shown when readOnly is false and the Flutter-drawn
context menu is shown when it is true.



https://github.com/user-attachments/assets/91480fa4-cce6-4d63-ae11-df72a229da73


This is the same root cause as
#169238.

Fixes #170521
@MilkBiscuit
Copy link

Could someone tell me that on which flutter version this bug is fixed? Thanks!

azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
When readOnly is true, there is no TextInputConnection, so the
SystemContextMenu can't be shown. Instead, this shows the Flutter-drawn
context menu.

This video shows the change. You can slightly tell that the system
context menu is shown when readOnly is false and the Flutter-drawn
context menu is shown when it is true.



https://github.com/user-attachments/assets/91480fa4-cce6-4d63-ae11-df72a229da73


This is the same root cause as
flutter#169238.

Fixes flutter#170521
@Ilham-Habibullin
Copy link

Is this released already? I just encountered this bug on flutter v3.32.7

@JoshStrobl
Copy link

I'm guessing this wasn't backported? Still seems busted in Flutter 3.32.8.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
When readOnly is true, there is no TextInputConnection, so the
SystemContextMenu can't be shown. Instead, this shows the Flutter-drawn
context menu.

This video shows the change. You can slightly tell that the system
context menu is shown when readOnly is false and the Flutter-drawn
context menu is shown when it is true.



https://github.com/user-attachments/assets/91480fa4-cce6-4d63-ae11-df72a229da73


This is the same root cause as
flutter#169238.

Fixes flutter#170521
@MilkBiscuit
Copy link

Is the fix merged into a released flutter version? Thanks!

@hasanmhallak
Copy link
Contributor

on stable v3.35.2 this did not land yet

mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
When readOnly is true, there is no TextInputConnection, so the
SystemContextMenu can't be shown. Instead, this shows the Flutter-drawn
context menu.

This video shows the change. You can slightly tell that the system
context menu is shown when readOnly is false and the Flutter-drawn
context menu is shown when it is true.



https://github.com/user-attachments/assets/91480fa4-cce6-4d63-ae11-df72a229da73


This is the same root cause as
flutter#169238.

Fixes flutter#170521
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
When readOnly is true, there is no TextInputConnection, so the
SystemContextMenu can't be shown. Instead, this shows the Flutter-drawn
context menu.

This video shows the change. You can slightly tell that the system
context menu is shown when readOnly is false and the Flutter-drawn
context menu is shown when it is true.



https://github.com/user-attachments/assets/91480fa4-cce6-4d63-ae11-df72a229da73


This is the same root cause as
flutter#169238.

Fixes flutter#170521
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 f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] SystemContextMenu error when using SelectableText

7 participants