Skip to content

docs-bug(Autocomplete): Documentation for (optionActivated) incorrect. #24799

@Blafasel3

Description

@Blafasel3

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.

Affected documentation page

https://material.angular.io/components/autocomplete/api

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/autocompletedocsThis issue is related to documentationgood first issueThis issue is a good place to start for first time contributors to the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions