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

fix: event listener not being invoked for native web components #4012

Merged
merged 6 commits into from
Mar 4, 2024

Conversation

jye-sf
Copy link
Contributor

@jye-sf jye-sf commented Feb 22, 2024

Details

Addresses #4011.

This PR attempts to bypass our addEventListener() patch when working with event targets under a native shadow root.

Remaining work:

  • Do we need to do something similar for removeEventListener() to avoid inconsistent behavior?
  • Investigate and fix test failures on existing tests
  • Refactor and move new tests to appropriate space

Does this pull request introduce a breaking change?

  • ✅ No, it does not introduce a breaking change.
  • 🚨 Yes, it does introduce a breaking change.

Does this pull request introduce an observable change?

  • ⚠️ Yes, it does include an observable change.

This changes the composed path in some scenarios. The full, explicit list of scenarios may need to be explored.

GUS work item

@jye-sf jye-sf requested a review from a team as a code owner February 22, 2024 20:52
Copy link
Contributor

@nolanlawson nolanlawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me, and I imagine the risk of breakage is low since it only affects native-within-synthetic.

One thing that may be useful is to add a test for a native shadow LWC component inside of the parent synthetic shadow container. AIUI, this doesn't have anything to do with lwc:external or third-party custom elements – it just has to do with native-shadow-inside-synthetic-shadow.

Copy link
Member

@ekashida ekashida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great starting point, let's beef up the tests next week!

@ekashida ekashida force-pushed the composed-path-shadow-polyfill branch from 4dd18b2 to fe0abfc Compare March 3, 2024 07:21
@jye-sf jye-sf merged commit 943fe6e into master Mar 4, 2024
9 checks passed
@jye-sf jye-sf deleted the composed-path-shadow-polyfill branch March 4, 2024 16:10
ekashida added a commit that referenced this pull request Mar 19, 2024
* fix: event listener not being invoked for native web components

* chore: simplify test

* chore: test tweaks

* chore: also avoid wrapping listeners for non-Node EventTargets

* chore: account for light dom nodes

* chore: account for window

---------

Co-authored-by: Eugene Kashida <ekashida@gmail.com>
ekashida added a commit that referenced this pull request Mar 19, 2024
… (#4080)

Co-authored-by: Jason Ye <40873183+jye-sf@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants