Skip to content

fix(cdk/overlay): pass document.body element instead of string to renderer.listen in keyboard dispatcher#33402

Open
arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/cdk_overlay_body_target
Open

fix(cdk/overlay): pass document.body element instead of string to renderer.listen in keyboard dispatcher#33402
arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/cdk_overlay_body_target

Conversation

@arturovt

Copy link
Copy Markdown
Contributor

Passing the string 'body' to renderer.listen() routes through the addGlobalEventListener path, which relies on the registered event plugin chain to resolve the target. When a custom RendererFactory2 or event plugin is in the chain (e.g. from provideAnimations()), that path may not support string targets for keyboard events, resulting in NG05102.

Passing the actual document.body element forces the renderer to use the element.addEventListener() path directly, bypassing plugin routing entirely. This is consistent with how OverlayOutsideClickDispatcher already attaches its listeners.

…derer.listen in keyboard dispatcher

Passing the string 'body' to renderer.listen() routes through the
addGlobalEventListener path, which relies on the registered event plugin
chain to resolve the target. When a custom RendererFactory2 or event
plugin is in the chain (e.g. from provideAnimations()), that path may
not support string targets for keyboard events, resulting in NG05102.

Passing the actual document.body element forces the renderer to use the
element.addEventListener() path directly, bypassing plugin routing
entirely. This is consistent with how OverlayOutsideClickDispatcher
already attaches its listeners.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant