Skip to content

(WIP) Proposal to simplify FocusTrap - #90240

Closed
justinmc wants to merge 7 commits into
flutter:masterfrom
justinmc:focus-trap-simplification
Closed

justinmc wants to merge 7 commits into
flutter:masterfrom
justinmc:focus-trap-simplification

Conversation

@justinmc

@justinmc justinmc commented Sep 17, 2021 •

Copy link
Copy Markdown
Contributor

This is a proposal to replace FocusTrap with a root Focus instead, in order to:

TODO

Flutter (this PR) Native web
flutter_focus web_focus

Related issues

Fixes #86972
Unblocks #76072
Original FocusTrap PR: #82575
Follow up that fixed clicks on prefix/suffix: #86041

@justinmc justinmc self-assigned this Sep 17, 2021
@flutter-dashboard flutter-dashboard Bot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Sep 17, 2021
@google-cla google-cla Bot added the cla: yes label Sep 17, 2021
@skia-gold

Copy link
Copy Markdown

Gold has detected about 10 new digest(s) on patchset 3.
View them at https://flutter-gold.skia.org/cl/github/90240

@skia-gold

Copy link
Copy Markdown

Gold has detected about 7 new digest(s) on patchset 4.
View them at https://flutter-gold.skia.org/cl/github/90240

@skia-gold

Copy link
Copy Markdown

Gold has detected about 10 new digest(s) on patchset 6.
View them at https://flutter-gold.skia.org/cl/github/90240

@skia-gold

Copy link
Copy Markdown

Gold has detected about 1 new digest(s) on patchset 7.
View them at https://flutter-gold.skia.org/cl/github/90240

@justinmc
justinmc force-pushed the focus-trap-simplification branch from 3a70ed9 to b0d5f21 Compare October 1, 2021 17:41
@skia-gold

Copy link
Copy Markdown

Gold has detected about 4 new digest(s) on patchset 7.
View them at https://flutter-gold.skia.org/cl/github/90240

@justinmc

justinmc commented Dec 3, 2021

Copy link
Copy Markdown
Contributor Author

Closing this until I have time to return to it.

@justinmc justinmc closed this Dec 3, 2021
@Hixie

Hixie commented Feb 28, 2022

Copy link
Copy Markdown
Contributor

@justinmc do you remember if this was looking promising or if it ran into some problems?

FWIW, I would definitely support efforts to remove FocusTrap entirely.

@justinmc

justinmc commented Mar 2, 2022

Copy link
Copy Markdown
Contributor Author

I'm going to update this PR and see if tests pass, etc. I remember really doubting myself that I could make this work with such a simple change, but I can't remember if I specifically ran into any major blockers.

@justinmc

justinmc commented Mar 7, 2022

Copy link
Copy Markdown
Contributor Author

@Hixie Here's the major blocker: the tests don't pass on web because the onTapDown is swallowing gestures. For example, for iOS's swipe back gesture, the onHorizontalDragUpdate is never called when the onTapDown is in the tree above it.

I imagine this can be solved with a custom tap gesture detector or something like that? If I get more time maybe I can figure out something that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider simplifying FocusTrap?

3 participants