• 
      

    Fix a couple mobile bugs on the unified banner's review menu.

    Review Request #14130 — Created Aug. 29, 2024 and submitted

    Information

    Review Board
    release-7.x

    Reviewers

    We had a couple bugs when using the review menu on mobile.

    The first has to do with the event overlay that we add to the page when the
    review menu opens. The overlay wasn't going away when closing the menu by
    tapping somewhere else on the unified banner (i.e. tapping the mode selector,
    publish buttons or empty space). And, if you opened the review menu again, a
    new overlay would be added, and the overlays would keep stacking if you
    repeated this.

    This is fixed by listening to the closing event on the menu and removing
    the overlay that way. Previously, we subclassed the closeMenu()
    method that exists on the parent Actions.MenuActionView and put the
    overlay removal logic in there. However that method doesn't actually
    always get called when the menu closes. The grandparent Ink MenuView
    sometimes closes the menu directly through its close() method. We may
    want to remove or rework these Actions.MenuActionView.openMenu() and
    closeMenu() methods in the future, since it could lead to unexpected
    state leftover like it did here.

    Secondly, the contents of the menu would get cut off when viewing on
    mobile. This change makes things look much better by forcing the menu
    contents to take up the entire width of the screen and wrap any text
    in it.

    • Tested opening, closing, and selecting items in the review menu in
      mobile and desktop.
    • Tested exiting the review menu by it and a lot of other places.
    • Tested scrolling with the menu open.
    • Ran JS unit tests.
    Summary ID
    Fix a couple mobile bugs on the unified banner's review menu.
    We had a couple bugs when using the review menu on mobile. The first has to do with the event overlay that we add to the page when the review menu opens. The overlay wasn't going away when closing the menu by tapping somewhere else on the unified banner (i.e. tapping the mode selector, publish buttons or empty space). And, if you opened the review menu again, a new overlay would be added, and the overlays would keep stacking if you repeated this. This is fixed by listening to the closing event on the menu and removing the overlay that way. Previously, we subclasses the `closeMenu()` method that exists on the parent `Actions.MenuActionView` and put the overlay removal logic in there. However that method doesn't actually always get called when the menu closes. The grandparent Ink `MenuView` sometimes closes the menu directly through its `close()` method. We may want to remove or rework these `Actions.MenuActionView.openMenu()` and `closeMenu()` methods in the future, since it could lead to unexpected state leftover like it did here. Secondly, the contents of the menu would get cut off when viewing on mobile. This change fixes this by forcing the menu contents to take up the width of the screen and wrap any text in it.
    62e2ea7bdcb15660fc0043d9652c041b4f024dfc

    Description From Last Updated

    Typo in the description: "we subclasses" -> "we subclassed"

    chipx86chipx86

    Does this permanently alter the wdith and other information? If you trigger this in a mobile width, then close the …

    chipx86chipx86

    We should aim to use default styles but not assume them, in case those need to change down the road. …

    chipx86chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    1. 
        
    2. Show all issues

      Typo in the description: "we subclasses" -> "we subclassed"

    3. Show all issues

      Does this permanently alter the wdith and other information? If you trigger this in a mobile width, then close the menu, resize to a desktop view, and then open the menu, what happens?

      1. Yes it does. The new changes here and in /r/14171/ address this.

    4. 
        
    maubin
    chipx86
    1. 
        
    2. Show all issues

      We should aim to use default styles but not assume them, in case those need to change down the road. There's a way with .css(). I think setting them to an empty string will remove the override, unless it's null.

      1. Oh I was thinking we were overriding Ink CSS. Nevermind.

      2. Actually this is what I wanted to do, I wanted to revert back to whatever value was there before we overrode it. I didn't know you could remove the inline styling by setting the values to an empty string.

        I'm going to go with what you suggested just to be safer and make sure we're actually going back to whatever was set in any css file instead of overriding it again with our own "default".

    3. 
        
    chipx86
    1. Ship It!
    2. 
        
    maubin
    chipx86
    1. Ship It!
    2. 
        
    maubin
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-7.x (4aa19fe)