Skip to content

Selection controls don't move when their text widget is scrolled #3861

Closed

Description

@mpcomplete

Put an Input control inside a Scrollable view and select some text. When you scroll the view, the selection controls (handles and toolbar) don't move.

We need some way of informing the selection UI that the Input has been moved. We don't have a generalized way of doing this yet. @Hixie's thoughts on the matter:

so yeah, fundamentally the answer to your question is no, widgets (or more to the point, render objects), have no idea if they're being moved. This is an issue with, e.g., Material ink splashes; if you put a button in a rotating animation and the animation in a Material and tap the button, the splash will go all wrong.
we have a workaround for lists specifically, lists bubble a ScrollNotification. but that doesn't help in the general case.
there is a theory that one solution would be to do this at the layer level
we could have a layer that is pinned to the position of another layer
since that's the one tree that we do walk entirely each frame
so then whatever logic you wanted to do could be hooked up to the layer
e.g. if you wanted the selection handles to track the selection, you'd put the text field in a layer, the handles in a layer, and you'd tell the handles layer to track the global position of the selection layer
we don't have any support for this right now. @abarth might have ideas for how it should look, he's our layers guy.

Activity

  1. self-assigned this
    on May 11, 2016
  2. mpcomplete commented on May 11, 2016

    @mpcomplete
    ContributorAuthor

    Workaround for now:

    in the meantime, you could move the selection handles to the input box level (just wrap an Overlay around the Input, and use that Overlay instead of the main one -- if you have all the maths right, it'll Just Work already). Then use the ScrollNotification from the input to know when to repaint them. We'll have to do something like that for iOS anyway.

  3. modified the milestone: on May 20, 2016
  4. added
    a: text inputEntering text in a text field or keyboard related problems
    on Jul 19, 2016
  5. modified the milestones: , on Jul 19, 2016
  6. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jul 28, 2016
  7. mpcomplete commented on Jul 28, 2016

    @mpcomplete
    ContributorAuthor

    Also note there are at least 2 Scrollables to deal with.

    1. The RawInputLine, the horizontal Scrollable internal to the Input. If you enter too much text on a single-line Input, you can scroll left/right.
    2. Any Scrollable containing the Input widget.

    1 is easier to fix, because RawInputLine knows about the selection handles and can notify them directly when it scrolls.

    2 is harder. Another option might be to allow arbitrary objects to subscribe to scroll notifications, and have the TextSelectionHandles walk up the widget tree, subscribing to scroll notifications from any Scrollable ancestor.

  8. removed this from the milestone on Aug 22, 2016
  9. modified the milestone: on Sep 12, 2016
  10. 12 remaining items

  11. modified the milestones: , 2: Make Early Adopters happy on Apr 6, 2017
  12. removed their assignment
    on May 16, 2017
  13. eseidelGoogle commented on Jun 1, 2017

    @eseidelGoogle
    Contributor

    Posse has identified this as a blocking issue for the app they're currently working on. Presumably due to it being easy to trigger and looking bad. :/

  14. Hixie commented on Jun 2, 2017

    @Hixie
    Contributor

    The plan is as follows:

    Create two new layer types, LeaderLayer and FollowerLayer. They both take a "LayerLink" object, the LeaderLayer populates it with a reference to itself when it's attached and removes the reference when it's detached.

    When a FollowerLayer is composited, it finds its LeaderLayer, and walks the compositor tree to find the common ancestor then determines the transform that goes from the follower's parent's coordinate space to the leader's coordinate space. It remembers this, and pushes a transform node into the scene builder.

    When hit testing, that transformation is applied when traversing render objects that use the FollowerLayer.

    I'll attempt to implement this next week.

  15. self-assigned this
    on Jun 2, 2017
  16. eseidelGoogle commented on Jun 14, 2017

    @eseidelGoogle
    Contributor

    Any update @Hixie? :)

  17. Hixie commented on Jun 14, 2017

    @Hixie
    Contributor

    Yeah, I'm half-way through writing a patch for this. The matrix maths is proving a little tricky. :-)

  18. Hixie commented on Jun 16, 2017

    @Hixie
    Contributor

    Ok I have a working fix, just need to do some cleanup.

  19. github-actions commented on Sep 4, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions