Line data Source code
1 847 : const NAVIGATION_KEYS = new Set([
2 : 'ArrowDown',
3 : 'ArrowUp',
4 : 'Home',
5 : 'End',
6 : 'PageDown',
7 : 'PageUp',
8 : 'Enter'
9 : ])
10 :
11 51 : export function replayComboboxNavigation(event: KeyboardEvent) {
12 51 : if (!event.isTrusted || event.isComposing || !NAVIGATION_KEYS.has(event.key))
13 31 : return
14 20 : const { target } = event
15 20 : event.preventDefault()
16 20 : event.stopPropagation()
17 20 : requestAnimationFrame(() =>
18 : target?.dispatchEvent(new KeyboardEvent(event.type, event))
19 : )
20 : }
|