ui: Enable keyboard access for the sorting dropdown menus (#8267)

This commit is contained in:
John Cowen 2020-07-09 13:41:34 +01:00 committed by hashicorp-ci
parent aa48d29191
commit 136decd2e8
2 changed files with 4 additions and 3 deletions

View File

@ -82,9 +82,10 @@ export default Component.extend({
// TODO: We need to use > somehow here so we don't select submenus
const $items = [...this.dom.elements(MENU_ITEMS, this.$menu)];
if (!this.expanded) {
this.$trigger.dispatchEvent(new MouseEvent('click'));
if (e.keyCode === ENTER || e.keyCode === SPACE) {
$items[0].focus();
next(() => {
$items[0].focus();
});
return;
}
}

View File

@ -1,5 +1,5 @@
<div class="popover-select" ...attributes>
<PopoverMenu @keyboardAccess={{false}}>
<PopoverMenu>
<BlockSlot @name="trigger">
<span>
{{selected.value}}