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] Make highlight change work better #23718

Merged
merged 4 commits into from
Nov 26, 2020

Conversation

TakumaKira
Copy link
Contributor

@TakumaKira TakumaKira commented Nov 25, 2020

What does it do?

  • Check every change of filteredOptions and execute onHighlightChange only when the highlighted option is changed
  • Fix highlighted index "force reset" when input value is null(highlighted index should be calculated properly even if input value is null)

Why is it needed?

  • Checking filteredOptions.length === 0 to check highlight change is not enough if filteredOptions is changed asynchronously.
  • Resetting highlighted index without considering if it should stay breaks the UX.

Related issue(s)/PR(s)

Fix #22170

@mui-pr-bot
Copy link

mui-pr-bot commented Nov 25, 2020

Details of bundle changes

Generated by 🚫 dangerJS against fb80e20

@oliviertassinari oliviertassinari added component: autocomplete This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Nov 25, 2020
@oliviertassinari oliviertassinari force-pushed the fix-on-highlight-change-option branch from ce53d5d to 4a4d3ce Compare November 25, 2020 20:17
@oliviertassinari oliviertassinari force-pushed the fix-on-highlight-change-option branch from 27c01fd to 615427d Compare November 25, 2020 20:23
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TakumaKira I have added a new test case to assert that we are moving in the right direction. The current tradeoff is to not reset the scroll if the option stays the same. It might not be enough, we will see :). One step at a time.

@oliviertassinari oliviertassinari merged commit cf14d02 into mui:next Nov 26, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 26, 2020

@TakumaKira I will ping you if we get a new issue on the same topic after these changes :D

@TakumaKira
Copy link
Contributor Author

TakumaKira commented Nov 27, 2020

@oliviertassinari OK, thanks!

@oliviertassinari oliviertassinari removed bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! labels Apr 28, 2023
@oliviertassinari oliviertassinari added component: autocomplete This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work and removed component: autocomplete This is the name of the generic UI component, not the React module! labels Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants