Et2Select: Fix keyboard navigation in search results & sidebox category closes

This commit is contained in:
nathan 2023-03-23 17:21:32 -06:00
parent 5614870a29
commit 8de9ffc240
2 changed files with 6 additions and 2 deletions

View File

@ -269,7 +269,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
this.addEventListener("mousewheel", this._handleMouseWheel);
this.addEventListener("mouseenter", this._handleMouseEnter);
this.addEventListener("mouseup", this.handleOptionClick);
this.addEventListener("keyup", this.handleKeyDown);
this.addEventListener("keydown", this.handleKeyDown);
this.updateComplete.then(() =>
{
@ -710,6 +710,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
this.handleMenuHide();
}
});
event.stopPropagation();
}
}

View File

@ -884,7 +884,10 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
// Pass off some keys to select
if(['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key))
{
return this.handleKeyDown(event);
// Strip out hidden non-matching selected & disabled items so key navigation works
this.menuItems = this.menuItems.filter(i => !i.disabled);
return super.handleKeyDown(event);
}
event.stopPropagation();