Commit dee81710 authored by Karen Konou's avatar Karen Konou

[Input with autocomplete] Fix reload on enter press

parent e97e7b30
...@@ -78,6 +78,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt ...@@ -78,6 +78,7 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
, on: { focus: onFocus completions state' , on: { focus: onFocus completions state'
, input: onInput completions , input: onInput completions
, change: onInput completions , change: onInput completions
, keyDown: onInputKeyDown inputRef
, keyUp: onInputKeyUp inputRef , keyUp: onInputKeyUp inputRef
, blur: onBlur completions containerRef , blur: onBlur completions containerRef
} }
...@@ -140,7 +141,16 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt ...@@ -140,7 +141,16 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
R2.blur input R2.blur input
pure false pure false
else else
pure $ false pure false
onInputKeyDown :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect Boolean
onInputKeyDown _ e = do
if DE.key e == "Enter" then do
R2.preventDefault e
R2.stopPropagation e
pure false
else
pure false
--------------------------------------------------------- ---------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment