-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
MatAutocomplete selection option event order #18650
Comments
Rather than using the |
We are trying to build a suggestion feature which is activated when the autocomplete is focused and the ngmodel is null. Currently this breaks with this scenario.
#5 happens because the focus event triggers before ngmodel is set. |
Currently we restore focus to the input and then we emit the change event, but we have a report that it may be making some use cases more difficult. From what I can tell, this shouldn't have much of an impact on existing users so these changes swap the order so that the focus event is last. Fixes angular#18650.
Currently we restore focus to the input and then we emit the change event, but we have a report that it may be making some use cases more difficult. From what I can tell, this shouldn't have much of an impact on existing users so these changes swap the order so that the focus event is last. Fixes #18650.
…#18707) Currently we restore focus to the input and then we emit the change event, but we have a report that it may be making some use cases more difficult. From what I can tell, this shouldn't have much of an impact on existing users so these changes swap the order so that the focus event is last. Fixes #18650.
…#18707) Currently we restore focus to the input and then we emit the change event, but we have a report that it may be making some use cases more difficult. From what I can tell, this shouldn't have much of an impact on existing users so these changes swap the order so that the focus event is last. Fixes #18650. (cherry picked from commit 7409bd6)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…angular#18707) Currently we restore focus to the input and then we emit the change event, but we have a report that it may be making some use cases more difficult. From what I can tell, this shouldn't have much of an impact on existing users so these changes swap the order so that the focus event is last. Fixes angular#18650.
Feature Description
The current order of events when selecting an option from MatAutocomplete is as follows:
This is the code which executes this logic.
I am proposing to call the focus() event after this.autocomplete._emitSelectEvent(event.source);
The issue is if you want to test the current selected model value in the focus() event it will be incorrect because the setting of the model happens after focus is called.
Use Case
In the focus event we are testing if the model value is blank and if so then open the panel to give suggested search items.
The text was updated successfully, but these errors were encountered: