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 GitHub
parent 239d42ebd3
commit 5b4c3057a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 // TODO: We need to use > somehow here so we don't select submenus
const $items = [...this.dom.elements(MENU_ITEMS, this.$menu)]; const $items = [...this.dom.elements(MENU_ITEMS, this.$menu)];
if (!this.expanded) { if (!this.expanded) {
this.$trigger.dispatchEvent(new MouseEvent('click'));
if (e.keyCode === ENTER || e.keyCode === SPACE) { if (e.keyCode === ENTER || e.keyCode === SPACE) {
next(() => {
$items[0].focus(); $items[0].focus();
});
return; return;
} }
} }

View File

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