Add a menu component.
Review Request #13641 — Created March 17, 2024 and submitted
The menu component provides a drop-down/pop-up or embedded menu,
complete with standard menu items, checkbox menu items, radio menu
items, and separators.Menu items may contain icons and keyboard shortcuts bound to those
items.All parts of the menu are built with accessibility in mind, making it
usable by people interacting with assistive technologies like screen
readers.Much of the implementation was built based on the experiences building
the original menu implementation in Review Board and in the
reviewboard.org website, with enhancements to enable crafting, keyboard
shortcuts, checkbox/radio items, embedded mode, and to fix interaction
issues.
Tested the menu in embedded and drop-down modes.
Tested that keyboard shortcuts are registered and work.
Tested light and dark modes.
Unit tests pass.
Summary | ID |
---|---|
8858c44155c9a570f4805a6c4ef53a60ff69bac2 |
Description | From | Last Updated |
---|---|---|
As I read through these, I'm wondering if we really want to be re-exporting everything. We're getting a whole bunch … |
david | |
This can just return here instead of assigning to a variable. |
david | |
This blank line is odd. |
david | |
Can we put fall-through cases adjacent to each other? I think I prefer: /* Move down an item */ case … |
david | |
If we compress the cases above, we can have only one blank line between sections, which seems more appropriate given … |
david | |
This API seems error-prone. It seems like it would be easy for a user to do sendKeys(el, 'Esc') and get … |
david |
-
-
As I read through these, I'm wondering if we really want to be re-exporting everything. We're getting a whole bunch of interfaces like
MenuViewOptions
along with the components themselves.In other code I've been writing, my approach has been to export anything that could be used elsewhere from the file, but only re-export the top-level classes. Code that actually needs the symbols for things like the options interfaces is comparatively rare, and can import what they need directly.
-
-
-
Can we put fall-through cases adjacent to each other? I think I prefer:
/* Move down an item */ case 'ArrowDown': /* Fall through */ case 'Down': ... break /** Move up an item */ case 'ArrowUp': /* Fall through */ case 'Up': ... break
-
If we compress the cases above, we can have only one blank line between sections, which seems more appropriate given the rest of our coding style.
-
This API seems error-prone. It seems like it would be easy for a user to do
sendKeys(el, 'Esc')
and get confusing behavior.I think I'd prefer that we either remove the
string
mode entirely in favor of always passing lists, or we have a separate function name for sending a sequence of single-character keys.
- Change Summary:
-
- Simplified
#findItemIndexForTypeahead
. - Fixed the text color on menus to be correct for the background.
- Simplified
- Commits:
-
Summary ID d9e35c22daf8e56abc131dea8230b096b86cad07 8858c44155c9a570f4805a6c4ef53a60ff69bac2 - Diff:
-
Revision 2 (+8674 -2)