• 
      

    Simplify SplitButtonView and fix visual consistency issues.

    Review Request #9317 — Created Oct. 24, 2017 and submitted

    Information

    Review Board
    release-3.0.x
    63cbc4f...

    Reviewers

    This makes a series of changes to SplitButtonView designed to solve
    visual inconsistencies with other buttons, improve placement and
    animation, preventing a problem where the button appeared below the
    draft banner, and preventing the button appearing out of nowhere after
    the review draft banner loads.

    The button now makes use of the new segmented button CSS rules in order
    to create a single outer button that then has segments for the label and
    drop-down arrow. These rules ensure that the button looks consistent
    with other buttons in the draft banner and Review Dialog. The segmented
    button takes care of the outer border appearance, letting us simplify
    the CSS a bit for the split button. The CSS has been simplified further
    by way of having classes set on the split button's element instead of
    the various child elements.

    The button's menu is no longer placed on the document body. Instead,
    it's placed within the container of the split button, alongside the
    segmented button. This avoids having to figure out a z-index, which
    wasn't working anymore on the draft banner (as that calculation
    depended on the banner being in the DOM, which it hasn't been for a
    while). It also doesn't set left anymore. This lets the menu align
    automatically with the button.

    The button and menu's width is no longer managed the same way. The
    button itself never changes width anymore, using the natural width
    instead (preventing it from appearing very long if the menu is long).
    The menu is now set to be at least as long as the button (using widths
    with subpixel-precision, instead of rounded client widths), and is set
    to not wrap (forcing it to extend beyond the button's width if needed,
    instead of wrapping, which is presumably why the buttons' width
    originally needed to be set).

    Animation is now controlled via CSS transitions instead of using
    jQuery's fading functions. This does require a timeout with a value
    matching the one used in CSS, but it otherwise enables much smoother
    animations.

    There are also fixes for presentation when there's multiple entries in
    the menu.

    And finally, the publish button on the draft banner no longer simply
    pops into existence after loading the page. The HTML for the button is
    now pre-populated on the banner. It will be replaced on load, but this
    prevents a weird transition after page load.

    Tested the Publish Review button on macOS (Chrome, Firefox, Safari) and
    Windows (Chrome, Firefox, IE, Edge) in both the draft banner and the
    Review Dialog.

    Loaded the page and saw that the Publish Review button was there
    immediately, and did not have any visual jump when the draft banner fully
    loaded.

    Injected additional items temporarily into the Publish Review buttons and
    verified that the entries all had correct styles in both pop-down and pop-up
    modes.

    Replaced the current item with one containing a short label. Verified that
    the menu had the button's exact width in both pop-down and pop-up modes.


    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.0.x (41a6b9e)