Switch to using KeyboardEvent.key instead of KeyboardEvent.code as KeyboardEvent.code always returns 'undefined' in MS Edge and IE 11. Also handle 'Up', 'Down', 'Esc' in addition to 'ArrowUp', 'ArrowDown', 'Escape' as IE 11 returns these values as the pressed keys. (#50)
This commit is contained in:
parent
467b35fa5d
commit
f0a1ce0b45
1 changed files with 4 additions and 4 deletions
|
@ -296,12 +296,12 @@ handleAction handleAction' handleEvent = case _ of
|
|||
Key ev -> do
|
||||
void $ H.fork $ handle $ SetVisibility On
|
||||
let preventIt = H.liftEffect $ preventDefault $ KE.toEvent ev
|
||||
case KE.code ev of
|
||||
"ArrowUp" ->
|
||||
case KE.key ev of
|
||||
x | x == "ArrowUp" || x == "Up" ->
|
||||
preventIt *> handle (Highlight Prev)
|
||||
"ArrowDown" ->
|
||||
x | x == "ArrowDown" || x == "Down" ->
|
||||
preventIt *> handle (Highlight Next)
|
||||
"Escape" -> do
|
||||
x | x == "Escape" || x == "Esc" -> do
|
||||
inputElement <- H.getHTMLElementRef $ H.RefLabel "select-input"
|
||||
preventIt
|
||||
for_ inputElement (H.liftEffect <<< HTMLElement.blur)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue