Et2SelectEmail: Fix keyboard navigation in search results

This commit is contained in:
nathan 2023-03-27 08:51:20 -06:00
parent 6cea4bae6d
commit 5872b77606

View File

@ -115,6 +115,24 @@ export class Et2SelectEmail extends Et2Select
});
}
/**
* Handle keypresses inside the search input
* Overridden from parent to also skip the hidden selected options, which other selects do not do
*
* @param {KeyboardEvent} event
* @protected
*/
protected _handleSearchKeyDown(event : KeyboardEvent)
{
// Pass off some keys to select
if(['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key))
{
// Strip out hidden non-matching selected so key navigation works
this.menuItems = this.menuItems.filter(i => !i.checked);
}
return super._handleSearchKeyDown(event);
}
/**
* Actually query the server.
*