angular / components Public
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
feat(MatDatepicker): Add pass-through change and click events to MatDatepickerToggle #21836
Comments
|
You should be able to bind a |
|
(click) is not firing for me. Nor is there a click event firing with my @HostListener (not shown). https://stackblitz.com/edit/components-issue-uosggb?file=src/app/example-component.ts |
|
Hi, the event propegetion is stopped, because it would focus the mat-form-field. https://github.com/angular/components/blob/master/src/material/datepicker/datepicker-toggle.ts#L116 |
|
I think that we should remove the |
Currently the datepicker toggle's `click` listener is on the inner `button` element and we call `stopPropagation` on it in order to prevent the form field from focusing the input. The problem is that doing so will also prevent any custom `click` handler that the user might have added to the `mat-datepicker-toggle`. These changes resolve the issue by moving the listener directly onto the toggle host which will invoke any external listeners while still allowing us to stop its propagation. Fixes angular#21836.
…ner (#21856) Currently the datepicker toggle's `click` listener is on the inner `button` element and we call `stopPropagation` on it in order to prevent the form field from focusing the input. The problem is that doing so will also prevent any custom `click` handler that the user might have added to the `mat-datepicker-toggle`. These changes resolve the issue by moving the listener directly onto the toggle host which will invoke any external listeners while still allowing us to stop its propagation. Fixes #21836.
…ner (#21856) Currently the datepicker toggle's `click` listener is on the inner `button` element and we call `stopPropagation` on it in order to prevent the form field from focusing the input. The problem is that doing so will also prevent any custom `click` handler that the user might have added to the `mat-datepicker-toggle`. These changes resolve the issue by moving the listener directly onto the toggle host which will invoke any external listeners while still allowing us to stop its propagation. Fixes #21836. (cherry picked from commit deebaae)
|
Not that anyone was asking, but confirmed in 11.2.1. |
|
Confirmed that it was fixed or confirmed that it's still happening? |
|
Confirmed as fixed. Sorry. |
|
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. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Feature Description
MatDatepickerToggle is a button, but it doesn't have a mechanism for apps that include it to know when it has been changed to clicked. This would be a useful feature.
Use Case
We do click metrics on the site, but I could see other cases where a developer might want to know when the date picker was opened.
The text was updated successfully, but these errors were encountered: