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

Autocomplete input value is reset on page scroll/on blur #378

Closed
lukasmatta opened this issue May 2, 2024 · 0 comments · Fixed by #379
Closed

Autocomplete input value is reset on page scroll/on blur #378

lukasmatta opened this issue May 2, 2024 · 0 comments · Fixed by #379
Assignees
Labels
bug Something isn't working library

Comments

@lukasmatta
Copy link
Collaborator

lukasmatta commented May 2, 2024

Behavior of the autocomplete component is a bit confusing. When user clicks out of the input or scrolls page, the value in the input is reset. I find it especially confusing with fetched options, as the following scenario might happen:

  1. User types a value to input.
  2. Options are fetched based on the value.
  3. User scrolls page.
  4. Input value is reset, but the options stay the same, as the function that is fetching options usually doesn't do so if the value is empty string*.

How to reproduce.

  1. Go to https://absaoss.github.io/cps-shared-ui/autocomplete/examples.
  2. Type "Pr" into the Single search autocomplete with fetched options list autocomplete.
  3. Scroll the page or click somewhere out of the input.
  4. Click on the input.
  5. Options stays set to "Prague" as this is the only option satisfying the "Pr" string, but the "Pr" string is not in the input anymore.

*The solution might be to simply reset options when the input value is empty string instead of returning and doing nothing, but I still find resetting input value on scroll/on blur unexpected.

@lukasmatta lukasmatta added the bug Something isn't working label May 2, 2024
@fateeand fateeand self-assigned this May 3, 2024
@fateeand fateeand linked a pull request May 6, 2024 that will close this issue
fateeand added a commit that referenced this issue May 7, 2024
* define cps menu hide reason

* don't clear autocomplete input field on scroll

* open options list on finish loading

* polish

* support divider type

* icons changes

* extend readme

* supported same logic in tree autocomplete

* remove unused line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants