Skip to content
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

Give the option to disable TapAndHorizontalDragGestureRecognizer and LongPressGestureRecognizer for TextFormFields and TextFields #130224

Open
2 tasks done
Scerbelo12 opened this issue Jul 9, 2023 · 10 comments
Assignees
Labels
a: text input Entering text in a text field or keyboard related problems c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: gestures flutter/packages/flutter/gestures repository. f: material design flutter/packages/flutter/material repository. P2 Important issues not at the top of the work list team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team

Comments

@Scerbelo12
Copy link

Scerbelo12 commented Jul 9, 2023

Is there an existing issue for this?

Use case

At the moment, it's impossible to make a TextFormField or a TextField a descendant of a draggable widget (like for example a ReorderableListView or a Slidable (from flutter_slidable)) without making impossible to use the latter.
That's due the fact that TextSelectionGestureDetectorBuilder gesture's (TapAndHorizontalDragGestureRecognizer and LongPressGestureRecognizer) are always the winners of the Gesture Arena.

So, for example, if we have the following Slidable:

  Slidable(
        child: Row(
          children: [
            SizedBox(width: 100, child: TextFormField()),
            SizedBox(width: 100, child: TextFormField()),
          ],
        ),
      );

it will be impossible to slide the row starting to drag from a point in the TextFormField area.

Proposal

Give the possibility to disable the features relative to text selection in the TextFormFields and TextFields, so that they can be use as descendants of widgets that respond to a drag gesture. Using the enabled property of the TextFormFields and TextFields doesn't solve the problem, cause I would still like to be able to edit the content of the fields.

@dam-ease dam-ease added the in triage Presently being triaged by the triage team label Jul 10, 2023
@dam-ease
Copy link

dam-ease commented Jul 10, 2023

Hi @Scerbelo12. Thanks for filing this. flutter_slidable is a community package. Can you also provide reorderablelistview example and also try using IgnorePointer class if it helps in your use case?

@dam-ease dam-ease added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 10, 2023
@Scerbelo12
Copy link
Author

Scerbelo12 commented Jul 10, 2023

Hi, yes I know that is a community package but the problem is related to the TextFields, not the package.

Example with reorderablelistview:

                    ReorderableListView(
                      children: [
                        Row(
                          key: UniqueKey(),
                          children: [
                            SizedBox(width: 100, child: TextFormField()),
                            SizedBox(width: 100, child: TextFormField()),
                          ],
                        ),
                      ],
                      onReorder: (p1, p2) {},
                    ),

IgnorePointer does not solve the problem since it makes impossible to tap on the TextField to edit the content.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jul 10, 2023
@dam-ease dam-ease added a: text input Entering text in a text field or keyboard related problems c: new feature Nothing broken; request for a new capability f: gestures flutter/packages/flutter/gestures repository. c: proposal A detailed proposal for a change to Flutter f: material design flutter/packages/flutter/material repository. team-design Owned by Design Languages team and removed in triage Presently being triaged by the triage team labels Jul 11, 2023
@Renzo-Olivares Renzo-Olivares self-assigned this Jul 12, 2023
@Scerbelo12
Copy link
Author

Hi @Renzo-Olivares , can I assume that my proposal is going to be implemented?

@Renzo-Olivares
Copy link
Contributor

Hi @Scerbelo12 I'm currently exploring methods to fix the issue described. I don't have a current timeline on the fix but there is a workaround I can point you to #127017 (comment) . Essentially it is to wrap the outer scroll view in a MediaQuery widget and define a custom gestureSettings that lowers the touchSlop so the outer recognizer can win before the TextField recognizers.

@Scerbelo12
Copy link
Author

Thanks, hope you can fix it soon

@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Jan 10, 2024
@flutter-triage-bot
Copy link

This issue is assigned to @Renzo-Olivares but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

@urusai88
Copy link

I have TextField in PageView. I want to keep TextField vertical scrolling, so i can't wrap TextField in IgnorePointer, but TapAndHorizontalDragGestureRecognizer wins when user trying to scroll horizontally to another page

@flutter-triage-bot
Copy link

This issue was assigned to @Renzo-Olivares but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label Mar 16, 2024
@justinmc justinmc added triaged-text-input Triaged by Text Input team P2 Important issues not at the top of the work list labels Mar 21, 2024
@flutter-triage-bot
Copy link

The triaged-text-input label is irrelevant if there is no team-text-input label or fyi-text-input label.

@flutter-triage-bot flutter-triage-bot bot removed the triaged-text-input Triaged by Text Input team label Mar 23, 2024
@Renzo-Olivares Renzo-Olivares added team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team and removed team-design Owned by Design Languages team labels Mar 26, 2024
@Renzo-Olivares Renzo-Olivares self-assigned this Apr 30, 2024
@Renzo-Olivares
Copy link
Contributor

Hi @Scerbelo12, as of #147341 you can now have a TextField as a descendant of a draggable widget and still have the draggable win the GestureArena. Are you still interested in this proposal?

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 c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter f: gestures flutter/packages/flutter/gestures repository. f: material design flutter/packages/flutter/material repository. P2 Important issues not at the top of the work list team-text-input Owned by Text Input team triaged-text-input Triaged by Text Input team
Projects
None yet
Development

No branches or pull requests

5 participants