Skip to content
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

MatAutocompleteTrigger panelClosingActions have inconsistent types. #7553

Closed
iblocks-Xander opened this issue Oct 5, 2017 · 1 comment · Fixed by #8533
Closed

MatAutocompleteTrigger panelClosingActions have inconsistent types. #7553

iblocks-Xander opened this issue Oct 5, 2017 · 1 comment · Fixed by #8533
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@iblocks-Xander
Copy link

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

@josephperrott josephperrott added the P2 The issue is important to a large percentage of users, with a workaround label Oct 31, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 18, 2017
Currently the `panelClosingActions` stream is typed to return a `MatOptionSelectionChange` event, however the real return data is `MatOptionSelectionChange|void|MouseEvent`, which makes it hard to use. These changes switch to emitting a `null` if nothing was selected or `MatOptionSelectionChange` if the user selected something.

Fixes angular#7553.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 10, 2017
Currently the `panelClosingActions` stream is typed to return a `MatOptionSelectionChange` event, however the real return data is `MatOptionSelectionChange|void|MouseEvent`, which makes it hard to use. These changes switch to emitting a `null` if nothing was selected or `MatOptionSelectionChange` if the user selected something.

Fixes angular#7553.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 22, 2017
Currently the `panelClosingActions` stream is typed to return a `MatOptionSelectionChange` event, however the real return data is `MatOptionSelectionChange|void|MouseEvent`, which makes it hard to use. These changes switch to emitting a `null` if nothing was selected or `MatOptionSelectionChange` if the user selected something.

Fixes angular#7553.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 30, 2018
Currently the `panelClosingActions` stream is typed to return a `MatOptionSelectionChange` event, however the real return data is `MatOptionSelectionChange|void|MouseEvent`, which makes it hard to use. These changes switch to emitting a `null` if nothing was selected or `MatOptionSelectionChange` if the user selected something.

Fixes angular#7553.
tinayuangao pushed a commit that referenced this issue May 16, 2018
…8533)

Currently the `panelClosingActions` stream is typed to return a `MatOptionSelectionChange` event, however the real return data is `MatOptionSelectionChange|void|MouseEvent`, which makes it hard to use. These changes switch to emitting a `null` if nothing was selected or `MatOptionSelectionChange` if the user selected something.

Fixes #7553.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants