-
Notifications
You must be signed in to change notification settings - Fork 27.2k
UseCapture:true event handlers #11200
Copy link
Copy link
Open
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: event listenersfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq1: low
Milestone
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: event listenersfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq1: low
I'm submitting a ... (check one with "x")
Current behavior
All events (click, keys, etc) are registered with a
addEventListener(...,()=>{...},false)in the browser_adapter. If we want to "cancel" them ahead, by capturing the event and calling stopPropagation(), we have to use a non-angular native JS.Desired behavior
A way to add a handler to an element that adds the event listener to the capture phase. I leave the syntax to you, but something like
@HostListener('~click',['$event'])seems logical to me (and similarly(~click)="...").What is the motivation / use case for changing the behavior?
Creating directives that disables clicks/key events/etc. If the element has a custom handler on it, we need to cancel the event BEFORE it gets there.
Please tell us about your environment: