Skip to content

Copy/paste toolbar needs smarter positioning #3945

Closed

Description

@mpcomplete

The copy/paste toolbar is always positioned above the selection. We should position it below the selection if it is too close to the top of the screen.

Activity

  1. Hixie commented on May 17, 2016

    @Hixie
    Contributor

    There's logic in the tooltip code to do something similar, might be able to factor it out into a reusable component.

  2. modified the milestone: on May 20, 2016
  3. modified the milestones: , on Jan 29, 2017
  4. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    p: material_uimaterial_ui package in flutter/packages
    a: text inputEntering text in a text field or keyboard related problems
    on Oct 10, 2017
  5. modified the milestones: 3: Current Milestone, on Oct 10, 2017
  6. xster commented on Jan 4, 2019

    @xster
    Member

    From #20692 remember to avoid placing the toolbar above the selected text itself when avoiding the edge.

    From #25632 remember to avoid placing the toolbar into the safe area when avoiding the edge.

  7. mikuhl-dev commented on Feb 3, 2019

    @mikuhl-dev

    Someone just pointed this out in my app. Embarrassing I cannot fix it.

  8. parsodyl commented on Feb 4, 2019

    @parsodyl

    Any update on this?

  9. justinmc commented on Apr 2, 2019

    @justinmc
    Contributor

    @parsodyl I hope to work on this soon. There is a major bug with this where the selection menu is overlapping the cutout, which was pointed out in the duplicate issue above.

    selection menu cutout overlap

  10. 4 remaining items

  11. justinmc commented on Apr 3, 2019

    @justinmc
    Contributor

    Thanks for the clarification 👍

  12. loongliu commented on Apr 8, 2019

    @loongliu
    Contributor

    This problem (selection menu is overlapping the cutout) is a main block for releasing our application. So we have to speed some time to fix it. Is this problem pull request welcome? @justinmc

  13. loongliu commented on Apr 8, 2019

    @loongliu
    Contributor

    Generally there are two solutions.

    1. change the position smarter. Put some safe space at top of screen, when TextField intersects with safe space, position toolbar below the TextField.
    2. Add a property such as overlayPosition to TextField, let developer to decide proper position. When desired position is not safe, use the offsite position.

    Android and iOS choose 1st solution. Tooltip widget chooses 2nd solution.
    I prefer 2nd solution, which brings more freedom when TextField is in the middle.

  14. justinmc commented on Apr 8, 2019

    @justinmc
    Contributor

    @loongliu You'd make a lot of people happy if you submitted a pull request for this! It's definitely welcome.

    I agree that we should try to make this solution follow what Tooltip does. We should try to reuse as much code as possible between the two. Take a look at _TooltipPositionDelegate and how it uses positionDependentBox. positionDependentBox seems like something we should reuse for this. Maybe even create a common widget shared with Tooltip that uses it?

  15. justinmc commented on Apr 8, 2019

    @justinmc
    Contributor

    Looks like there is already an outstanding PR that should solve this: #29809

    @loongliu I'm interested in your feedback on that PR if it solves your problem!

  16. justinmc commented on May 6, 2019

    @justinmc
    Contributor

    This is now fixed with #29809.

    To get the changes, you'll need a Flutter version greater than 1.5.8, or for now you can use the master channel.

  17. jlund24 commented on Jun 27, 2019

    @jlund24

    I'm a little confused. Should the copy/paste menu now not be displaying under the appbar (or other obstructions) after the PR mentioned above? Because it's still happening for me. Sorry if I'm misunderstanding the fix.
    Screen Shot 2019-06-27 at 3 24 59 PM

  18. justinmc commented on Jun 27, 2019

    @justinmc
    Contributor

    @jlund24 In your case the menu should appear on top of the appbar, and this issue's fix shouldn't affect you. Is anything complicated happening in your main view that could affect the stacking order? Here is what I see on master:

    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Welcome to Flutter',
          home: Scaffold(
            appBar: AppBar(
              title: Text('Welcome to Flutter'),
            ),
            body: Center(
              child: Column(
                children: <Widget>[
                  TextField(
                    autofocus: true,
                  ),
                ],
              ),
            ),
          ),
        );
      }
    }
  19. jlund24 commented on Jun 27, 2019

    @jlund24

    @justinmc possibly, the textfields are in a Reorderable listview. The copy/paste menu also seems to cause an error talking about paint order when reordering with the menu open which I'm guessing is related. Would the list view be forcing some strange stacking behavior?

  20. jlund24 commented on Jun 27, 2019

    @jlund24

    I can create a separate issue with an example if that would be more appropriate since it sounds like my issue is different than the one this thread is concerned with

  21. justinmc commented on Jun 27, 2019

    @justinmc
    Contributor

    That could be it... Yes please open a new issue. If you can, try to pare down the problem into a minimal app and include it in the issue.

  22. jlund24 commented on Jun 27, 2019

    @jlund24

    Created a new issue that can be found here: #35227

  23. github-actions commented on Aug 17, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions