phase2 / outline

Tooling infrastructure for modern web component development.
https://outline.phase2tech.com
MIT License
128 stars 27 forks source link

[legacy-next] Updating slots-controller with dispatching events #371

Closed shaal closed 1 year ago

shaal commented 1 year ago

Description

This PR adds the ability to dispatch events from the cloned slots in the shadow DOM to the equivalent slots in the light DOM.

Previously, SlotsController cloned slots from the light DOM to the shadow DOM and triggered a re-render when any changes were detected in the light DOM. This update adds the capability of dispatching events specified in the cloned slots to the equivalent slots in the light DOM.

The dispatchEventsToLightDom() function has been added to the controller. When an event is triggered in a cloned slot, this function identifies the path of the event's origin in the shadow DOM. It then finds the equivalent path in the light DOM, dispatches the event to the light DOM, and resets the focus to the component that hosts the element.

This PR is intended to enhance the functionality of SlotsController, providing a more complete solution for cloning and event dispatching in a component.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration You can see it works here - https://7red81.csb.app/

Checklist

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 08c4b618f456b9f8bf70878ba6ce8f218366802c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

netlify[bot] commented 1 year ago

Deploy Preview for outlinejs failed.

Name Link
Latest commit 08c4b618f456b9f8bf70878ba6ce8f218366802c
Latest deploy log https://app.netlify.com/sites/outlinejs/deploys/6402691db3a9f600083a7259