-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Forking off from #65; context doesn't work when creating elements without { shadow: true }.
The cause is that the event listener is attached to a slot in shadow mode, and to a Fragment in light DOM mode. Fragments don't handle the events.
I've confirmed that replacing the Fragment with a real element fixes the issue, by applying the change below. I'm opening this issue instead of creating a pull-request, as wrapping elements in another custom element, might be undesired.
Potential fix, replace these lines:
preact-custom-element/src/index.js
Lines 180 to 181 in 0a8ccf7
| const { useFragment, ...rest } = props; | |
| return h(useFragment ? Fragment : 'slot', { ...rest, ref }); |
With:
const { useFragment, ...rest } = props;
let tag = 'slot';
if (useFragment) {
tag = 'preact-context-bridge';
rest.style = 'display: contents;';
}
return h(tag, { ...rest, ref });rschristian
Metadata
Metadata
Assignees
Labels
No labels