Add RB.MenuButtonView, for creating single or split buttons with menus.

Review Request #10907 — Created Feb. 19, 2020 and submitted

Information

Review Board
release-4.0.x
8e6ff56...

Reviewers

This introduces a new RB.MenuButtonView component, which uses the new
.rb-c-menu-button CSS component. This offers the ability to create a
single button that works as a drop-down menu, or a split button that has
a primary action and a separate drop-down button.

This is the successor to RB.SplitButtonView, which is now deprecated.
There are still differences, in that RB.SplitButtonView allows for
specifying IDs on menu items, but as that's not entirely useful in
practice, the functionality has not been carried over.

This improves upon RB.SplitButtonView in plenty of other ways. It can
now function in a split mode or in a single-button mode. It has ARIA
attributes and keyboard navigation (though RB.SplitButtonView now
inherits this). It also now smartly pops the menus either above or below
the button depending on space, rather than having to provide that detail
during construction.

Unit tests cover the majority of the rendering, accessibility, and
events.

Tested RB.MenuButtonView in single-button and split-button modes.

Tested all mouse and keyboard navigation.

Tested legacy usage of RB.SplitButtonView.

Checked the elements in the ARIA tree to make sure they appeared sane.

Unit tests pass.

Description From Last Updated

Leftover debug output

daviddavid

Col: 15 'dropDownHTML' is defined but never used.

reviewbotreviewbot

Col: 15 'dropDownHTML' is defined but never used.

reviewbotreviewbot
There are no open issues
Checks run (1 failed, 1 succeeded)
flake8 passed.
JSHint failed.

JSHint

david
  1. 
      
  2. Show all issues

    Leftover debug output

  3. 
      
chipx86
Review request changed
Change Summary:

Removed leftover debug output.

Commit:
0055193994ac52ca6f0435cf9dcd504c21f74728
0806c00abf6f5f7ba2a981b2948489b2e0df3ef2
Diff:

Revision 2 (+524 -188)

Show changes

reviewboard/staticbundles.py
reviewboard/static/rb/css/ui/buttons.less
reviewboard/static/rb/js/ui/views/menuButtonView.es6.js
reviewboard/static/rb/js/ui/views/splitButtonView.es6.js
reviewboard/static/rb/js/ui/views/tests/menuButtonViewTests.es6.js
reviewboard/static/rb/js/views/draftReviewBannerView.es6.js
reviewboard/static/rb/js/views/reviewDialogView.es6.js
reviewboard/templates/reviews/reviewable_base.html

Checks run (1 failed, 1 succeeded)

flake8 passed.
JSHint failed.

JSHint

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (82291a0)
Loading...