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

fix: fix search input when value is prepopulated #290

Merged

Conversation

nolanlawson
Copy link

@nolanlawson nolanlawson commented Mar 10, 2019

In some cases (notably with Preact it seems), the <input type="search"> value may be prepopulated (due to cached DOM nodes being re-hydrated, I suppose). In those cases, you can cause a bug if you do e.g.:

  1. Type "horse" into the search
  2. Press enter to choose the 🐴 emoji
  3. Reopen the picker (can't be reproduced in the storybook, but can be reproduced in Pinafore)
  4. The search input is prepopulated, but the search results are empty

This fixes that, by performing a search if the input happens to contain any text.

nolanlawson added a commit to nolanlawson/emoji-mart that referenced this pull request Mar 10, 2019
…d-search

fix: fix search input when value is prepopulated
@nolanlawson
Copy link
Author

Interestingly, this bug seems fixed in [email protected] (the search input is not pre-populated), but since it's a small amount of code, it seems worthwhile to do what we can to avoid an outright bug.

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

Successfully merging this pull request may close these issues.

1 participant