Replies: 1 comment 4 replies
-
The first argument inside Your problem is that you're not telling the UI where it should be mounted on the page, so it defaults to the end of the page's Pass the const anchor = item.getElementsByClassName('card-container')[0];
if (!anchor) return;
const ui = await createShadowRootUi(ctx, {
name: 'search-result-ui-' + ID + '-' + i,
anchor,
// ...
}); You're probably confusing yourself since you have a shadowed variable named |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Team,
Thanks for putting the work in to create wxt - I'm really enjoying the improved DX so far.
May I ask for a little clarity on usage of createShadowRootUi and specifically the
onMount
callback?I'm writing a content script in Svelte that will append multiple mini svelte apps (ideally isolated in the Shadow DOM). I've got the target elements where each Svelte app will live and I'm trying to use the createShadowRootUi within a loop to mount them.
onMount
takes 3 args;uiContainer: HTMLElement, shadow: ShadowRoot, shadowHost: HTMLElement
It's late and perhaps I'm just getting confused but what should I be passing in here - the current example under getting started only passes in the uiContainer and I think I'm getting my terminology mixed up here but I'm struggling to have the apps appended to the correct location in the DOM and the end result is they end up appended at the end of the DOM.
EDIT - here's my current code and I'd like to append each Svelte app to the correct target element:
Fresh eyes tomorrow will likely resolve but I thought I'd say hello and ask :-)
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions