-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Bug, feature request, or proposal:
Feature Request
What is the expected behavior?
When using an Overlay from the CDK and the user clicks on the backdrop return the underlying DOM click event to backdropClicked() subscribers. This is useful in some scenarios where we might need to do something like event.preventDefault();
What is the current behavior?
The backdropClicked() event emitter doesn't include the dom click event when it emits (it emits null),
// Forward backdrop clicks such that the consumer of the overlay can perform whatever
// action desired when such a click occurs (usually closing the overlay).
this._backdropElement.addEventListener('click', () => this._backdropClick.next(null));
What are the steps to reproduce?
Create an Overlay, and subscribe to it's BackdropClicked() event emitter. Click on the backdrop, and see that the next callback receives null
instead of the dom click event.
What is the use-case or motivation for changing an existing behavior?
It may be useful to stopPropigation()
or preventDefault()
when clicking on the backdrop of an overlay. But we can't do that if the DOM event for the click is not passed on to the backdropClicked() subscriber.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5.2.2, CDK v5.1.0