-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Documentation Feedback
The doc for the optionActivated
EventEmitter at
https://github.com/angular/components/blob/master/src/material/autocomplete/autocomplete.ts#L188
and
https://material.angular.io/components/autocomplete/api
states "Emits whenever an option is activated using the keyboard."
This behavior was changed by the fix https://github.com/angular/components/pull/19666/files (Issue: #19661).
The event is now fired for the automatically activated first option as well which is definitely not triggered by the keyboard.
Up for discussion: It might be helpful to be able to distinct between the two event sources since one is a user interaction (such as arrow down, up, ..) and the other is programmatically. Furthermore, I believe the strict object reference check introduced in the aforementioned fix is not completely correct since the object reference might have changed but the content might be the same. This is the case in our project because the mat-option
values are a mapped version of outside data which is updated quite often. The mapping results in new objects for the same entity on a particular update and it looks like a new activation.