Skip to content

MatAutocompleteTrigger panelClosingActions have inconsistent types. #7553

Closed
@iblocks-Xander

Description

@iblocks-Xander

Bug, feature request, or proposal:

The actions emitted by the panelClosingActions are not consistent

What is the expected behavior?

All actions should be typed as MdOptionSelectionChange according to the type signature of the field.

What is the current behavior?

Depending on how the panel is closed, the following actions are emitted:

  1. Tabbing out to close panel => panelClosingActions emits an undefined
  2. Clicking outside panel => panelClosingActions emits a MouseEvent
  3. If the form value was cleared and an option is clicked=> panelClosingActions emits MdOptionSelectionChange
  4. If the form value was not cleared and an option is clicked => panelClosingActions does not emit a value
  5. The first time an option is selected with Enter press => panelClosingActions emits MdOptionSelectionChange
  6. Subsequent times an option is selected with Enter press => panelClosingActions does not emit a value
  7. Closing panel with Esc => panelClosingActions does not emit a value (Although this might have been fixed by fix(autocomplete): emit closing action for escape keydown event #6250)

What are the steps to reproduce?

https://plnkr.co/edit/FjX9XJD6NkxddNtRLngb?p=preview

What is the use-case or motivation for changing an existing behavior?

This inconsistency makes it very hard to actually use panelClosingActions as a reliable source for the actual value selected.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.4.3, Material2 beta.11, Chrome, Windows

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions