Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple input signal loses focus after first character of input #24

Closed
bbarker opened this issue Jul 31, 2019 · 2 comments
Closed

Simple input signal loses focus after first character of input #24

bbarker opened this issue Jul 31, 2019 · 2 comments

Comments

@bbarker
Copy link
Contributor

bbarker commented Jul 31, 2019

Here's an example:

locNameSig :: Maybe String -> Signal HTML (Maybe String)
locNameSig nameMay = step nameMay do
  newName <- D.div' [
    D.h3' [D.text "Institution Name"]
  , D.input [P.unsafeTargetValue <$> P.onChange]
  ]
  pure $ locNameSig $ if newName == "" then Nothing else Just newName

After entering a single character, focus is undesirably lost. Some google searches suggest this may be because the widget is being re-rendered, which makes sense, but why only on the first key press? Subsequent entries into the input field work as expected, and in in all cases the output is always emitted as hoped.

@bbarker
Copy link
Contributor Author

bbarker commented Jul 31, 2019

Reference: redux-form/redux-form#1094

@bbarker
Copy link
Contributor Author

bbarker commented Aug 1, 2019

I'm not sure what I changed, nothing in the code above, so it must have been external. But it seems working now, so I'll close this for now.

@bbarker bbarker closed this as completed Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant