You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sounds right, and I'd like to solve this in HTML spec instead (because ShadowRoot does not include GlobalEventHandlers right now). Can you open an issue there (and perhaps link back here)?
Just ran in to this. Events like "pointerdown" are allowed to be added to ShadowRoot and work correctly in practice, but are missing from ShadowRootEventMap, and so legal code can be incorrectly marked as an error. Example:
constshadowRoot=newShadowRoot();functionhandlePointerDown(e: PointerEvent){}// Error: Argument of type 'Event' is not assignable to parameter of type 'PointerEvent'shadowRoot.addEventListener("pointerdown",e=>handlePointerDown(e));
Workaround: write handlePointerDown(e as PointerEvent).
Activity
saschanaz commentedon Mar 22, 2023
Sounds right, and I'd like to solve this in HTML spec instead (because ShadowRoot does not include GlobalEventHandlers right now). Can you open an issue there (and perhaps link back here)?
Fxxxlei commentedon Mar 22, 2023
There already seems to be an issue referring to a few more inconsistencies involving event bubbling: whatwg/dom#1097
AshleyScirra commentedon Jul 24, 2026
Just ran in to this. Events like "pointerdown" are allowed to be added to ShadowRoot and work correctly in practice, but are missing from ShadowRootEventMap, and so legal code can be incorrectly marked as an error. Example:
Workaround: write
handlePointerDown(e as PointerEvent).