Skip to content

fix(material/autocomplete): don't reset active option if list of options changes #16616

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crisbeto
Copy link
Member

Currently we reset the active option whenever the list of items changes, however this means that the user's selection could be lost while they're interacting, if some items get added to the end of the list out of view (e.g. if the options are fetched via polling).

These changes address the issue by only resetting the active option when the panel is opened.

Fixes #16608.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jul 26, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 26, 2019
jelbourn
jelbourn previously approved these changes Jul 26, 2019
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jul 26, 2019
@crisbeto crisbeto force-pushed the 16608/autocomplete-option-change-reset branch from 2fd76ac to f9294f0 Compare August 21, 2019 19:08
@andrewseguin andrewseguin added presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged and removed action: merge The PR is ready for merge by the caretaker labels Aug 21, 2019
@andrewseguin
Copy link
Contributor

Presubmit failures - Looks like some tests rely on the fact that they can insert options after the panel is opened and expect the first item to be active. This is not the case now that option changes do not activate the first item

@mmalerba mmalerba removed the lgtm label Jul 31, 2020
@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2021
…ons changes

Currently we reset the active option whenever the list of items changes, however this means that the user's selection could be lost while they're interacting, if some items get added to the end of the list out of view (e.g. if the options are fetched via polling).

These changes address the issue by only resetting the active option when the panel is opened.

Fixes angular#16608.
@crisbeto crisbeto force-pushed the 16608/autocomplete-option-change-reset branch from f9294f0 to 01209a2 Compare March 13, 2022 11:22
@crisbeto crisbeto changed the title fix(autocomplete): don't reset active option if list of options changes fix(material/autocomplete): don't reset active option if list of options changes Mar 13, 2022
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed needs rebase presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged labels Mar 13, 2022
@crisbeto
Copy link
Member Author

I've rebased this and come up with a different approach to try and minimize presubmit issues. Will run another presubmit to verify.

@crisbeto
Copy link
Member Author

The alternate approach broke a bunch of clients, because the first option no longer gets activated after the user filters the list.

@andrewseguin andrewseguin added needs rebase and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Mar 24, 2022
@josephperrott josephperrott added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed needs rebase labels Nov 16, 2022
@josephperrott josephperrott requested a review from a team as a code owner December 18, 2024 17:40
@josephperrott josephperrott requested review from amysorto and mmalerba and removed request for a team December 18, 2024 17:40
@mmalerba mmalerba removed their request for review February 20, 2025 00:58
@mmalerba mmalerba added presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged and removed action: merge The PR is ready for merge by the caretaker labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding items to autocomplete remove active item
6 participants