Skip to content
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

[labs/context] ContextRoot fails for consumers in nested shadowRoots #3833

Closed
sorvell opened this issue Apr 21, 2023 · 0 comments · Fixed by #3834
Closed

[labs/context] ContextRoot fails for consumers in nested shadowRoots #3833

sorvell opened this issue Apr 21, 2023 · 0 comments · Fixed by #3834
Assignees

Comments

@sorvell
Copy link
Member

sorvell commented Apr 21, 2023

Which package(s) are affected?

Context (@lit-labs/context)

Description

When a ContextRoot caches a context-request event, it stores the event.target. However, if the event is retargeted, this is not the element that fired the event and therefore needs the context to be fulfilled.

Likely instead, it should be caching the root target, or event.composedPath()[0].

Reproduction

https://lit.dev/playground/#gist=83c8ff4813b2edd082b29fb03557a82b

The bottom element's context value in the example above is not provided due to this issue.

Workaround

I have not found a workaround.

Is this a regression?

Yes. This used to work, but now it doesn't.

Affected versions

all

Browser/OS/Node environment

All

@sorvell sorvell self-assigned this Apr 21, 2023
sorvell pushed a commit that referenced this issue Apr 22, 2023
Fixes #3833 by avoiding event re-targeting issues when context
requesting elements are in nested shadowRoots.
sorvell pushed a commit that referenced this issue Apr 24, 2023
Ensure ContextRoot stores event root target avoiding event re-targeting issues when context
requesting elements are in nested shadowRoots, fixes #3833.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant