Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Feb 20, 2024

Some users of SelectableText seem to be unaware of SelectionArea/SelectableRegion, and our docs have no references between these very similar widgets. This PR adds references and attempts to nudge users in the direction of SelectionArea/SelectableRegion instead of SelectableText.

@Hangyujin @Renzo-Olivares My understanding is that there are a few things that SelectableText can do that SelectableRegion cannot, so for now the plan is to keep it around until it can be totally replaced by SelectableRegion. Is that right? Am I ok to strongly nudge users away from SelectableText?

The main flaw (or feature?) of SelectableText that I'm thinking of is that multiple SelectableTexts show multiple simultaneous selection, which can be seen in this dartpad. Using SelectableText, it's easy to stick two of them somewhere and have this poor experience for your users.

Screenshot from 2024-02-20 13-48-33

FYI @chunhtai

Fixes #119911

@justinmc justinmc self-assigned this Feb 20, 2024
@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 Feb 20, 2024
@justinmc justinmc marked this pull request as ready for review February 20, 2024 21:21

/// A run of selectable text with a single style.
///
/// Consider using [SelectionArea] or [SelectableRegion] instead, which enable
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should mention something about using along with a Text widget.

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 call.

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 comment.

The current plan is to reimplement SelectableText with SelectionArea #104547. The multiple selections issue should be resolved as there are not multiple selections when using multiple SelectionAreas.

I think the recommendation to use SelectionArea with multiple Text widgets is reasonable.

@hannah-hyj
Copy link
Member

LGTM, I agree it's ok to nudge users away from SelectableText

@justinmc justinmc merged commit e6a6a47 into flutter:master Feb 28, 2024
@justinmc justinmc deleted the selectable-text-docs-rec branch February 28, 2024 22:36
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 29, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 29, 2024
flutter/flutter@d00bfe8...e92bca3

2024-02-29 [email protected] [flutter_tools] Update external link in Android manifest template (flutter/flutter#144302)
2024-02-29 [email protected] Roll Flutter Engine from 232217f39c3c to d068d980f952 (1 revision) (flutter/flutter#144369)
2024-02-29 [email protected] Roll Flutter Engine from 9e1876141be8 to 232217f39c3c (1 revision) (flutter/flutter#144366)
2024-02-29 [email protected] Roll Flutter Engine from 61510db94a1c to 9e1876141be8 (1 revision) (flutter/flutter#144362)
2024-02-29 [email protected] Roll Flutter Engine from 10331db8f748 to 61510db94a1c (5 revisions) (flutter/flutter#144355)
2024-02-29 [email protected] Docs on the interaction between Shortcuts and text input (flutter/flutter#144328)
2024-02-29 [email protected] Use robolectric/AndroidJUnit4 for integration test tests (flutter/flutter#144348)
2024-02-29 [email protected] Reland "Cache FocusNode.enclosingScope, clean up descendantsAreFocusable (#144207)" (flutter/flutter#144330)
2024-02-29 [email protected] Roll Flutter Engine from 455c814fe5de to 10331db8f748 (7 revisions) (flutter/flutter#144345)
2024-02-29 [email protected] ReportTiming callback should record the sendFrameToEngine when it was scheduled (flutter/flutter#144212)
2024-02-29 [email protected] Disable flaky golden file test (flutter/flutter#144351)
2024-02-28 [email protected] Mention SelectionArea in SelectableText docs (flutter/flutter#143784)
2024-02-28 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 6.0.0 to 6.0.1 (flutter/flutter#144344)
2024-02-28 [email protected] Reland "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2" (flutter/flutter#144273)
2024-02-28 [email protected] Remove irrelevant comment in TextPainter (flutter/flutter#144308)

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 [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/packages that referenced this pull request Mar 7, 2024
flutter/flutter@d00bfe8...e92bca3

2024-02-29 [email protected] [flutter_tools] Update external link in Android manifest template (flutter/flutter#144302)
2024-02-29 [email protected] Roll Flutter Engine from 232217f39c3c to d068d980f952 (1 revision) (flutter/flutter#144369)
2024-02-29 [email protected] Roll Flutter Engine from 9e1876141be8 to 232217f39c3c (1 revision) (flutter/flutter#144366)
2024-02-29 [email protected] Roll Flutter Engine from 61510db94a1c to 9e1876141be8 (1 revision) (flutter/flutter#144362)
2024-02-29 [email protected] Roll Flutter Engine from 10331db8f748 to 61510db94a1c (5 revisions) (flutter/flutter#144355)
2024-02-29 [email protected] Docs on the interaction between Shortcuts and text input (flutter/flutter#144328)
2024-02-29 [email protected] Use robolectric/AndroidJUnit4 for integration test tests (flutter/flutter#144348)
2024-02-29 [email protected] Reland "Cache FocusNode.enclosingScope, clean up descendantsAreFocusable (#144207)" (flutter/flutter#144330)
2024-02-29 [email protected] Roll Flutter Engine from 455c814fe5de to 10331db8f748 (7 revisions) (flutter/flutter#144345)
2024-02-29 [email protected] ReportTiming callback should record the sendFrameToEngine when it was scheduled (flutter/flutter#144212)
2024-02-29 [email protected] Disable flaky golden file test (flutter/flutter#144351)
2024-02-28 [email protected] Mention SelectionArea in SelectableText docs (flutter/flutter#143784)
2024-02-28 49699333+dependabot[bot]@users.noreply.github.com Bump peter-evans/create-pull-request from 6.0.0 to 6.0.1 (flutter/flutter#144344)
2024-02-28 [email protected] Reland "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2" (flutter/flutter#144273)
2024-02-28 [email protected] Remove irrelevant comment in TextPainter (flutter/flutter#144308)

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 [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 14, 2024
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.

Documentation on SelectableText should mention SelectionArea

3 participants