From 54d636f0206e8fa7dd67a465de643e6dd9fc29cf Mon Sep 17 00:00:00 2001 From: Westbrook Date: Thu, 29 Jul 2021 17:14:46 -0400 Subject: [PATCH] feat(action-menu): remove menu selection by default Use the `selects` attribute set to `single` for previous functionality. --- packages/action-menu/README.md | 25 ++++++++++++++++++++++++- packages/action-menu/src/ActionMenu.ts | 3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/action-menu/README.md b/packages/action-menu/README.md index 8c9381a519..df4191f487 100644 --- a/packages/action-menu/README.md +++ b/packages/action-menu/README.md @@ -1,6 +1,6 @@ ## Description -An `` is an action button with a Popover. Use an `` element to outline the items that will be made available to the user when interacting with the `sp-action-menu` element. +An `` is an action button that triggers an overlay with `` for activation. Use an `` element to outline the items that will be made available to the user when interacting with the `` element. By default `` does not manage a selection. If you'd like for a selection to be held by the `` that is presented in its overlay, use `selects="single"` to activate this functionality. ### Usage @@ -219,6 +219,29 @@ A custom icon can be supplied via the `icon` slot in order to replace the defaul ``` +### Selection. + +When `selects` is set to `single`, the `` element will maintain one selected item after an initial selection is made. + +```html +

+ The value of the `<sp-action-menu>` element is: + +

+ + Available shapes + Square + Triangle + Parallelogram + Star + Hexagon + Circle + +``` + ## Accessibility An `` parent will ensure that the internal `` features a role of `listbox` and contains children with the role `option`. Upon focusing the `` using `ArrowDown` will also open the menu while throwing focus into first selected (or unselected when none are selected) menu item to assist in selecting of a new value. diff --git a/packages/action-menu/src/ActionMenu.ts b/packages/action-menu/src/ActionMenu.ts index 18aab61be3..a12839ecf8 100644 --- a/packages/action-menu/src/ActionMenu.ts +++ b/packages/action-menu/src/ActionMenu.ts @@ -30,6 +30,9 @@ import actionMenuStyles from './action-menu.css.js'; * @element sp-action-menu * @slot icon - The icon to use for action button * @slot label - The label to use on for the action button + * @attr selects - By default `sp-action-menu` does not manage a selection. If + * you'd like for a selection to be held by the `sp-menu` that it presents in + * its overlay, use `selects="single" to activate this functionality. */ export class ActionMenu extends ObserveSlotText(PickerBase, 'label') { public static get styles(): CSSResultArray {