Replies: 1 comment 4 replies
-
Hey @3goats I'm going to go ahead and link to your previous issue on the other project, for full context here. Sometimes folks refer to old issues so I want to ensure we include this: skeletonlabs/floating-ui-svelte#135 The info I provided about trying to make SVGs interactive is still relevant here. However, you mentioned you had built your own event listeners per each Typically actions are triggered using the
As long as you satisfy number 2, you can still use the popup as intended. Here's the Popup action source so you can see what I mean: It takes in two parameters:
So if we want to trigger the First, create element references we can bind to: let elementCircleOne: HTMLElement;
let elementCircleTwo: HTMLElement;
let elementCircleThree: HTMLElement; Then, bind to each element using the <g id="overlay">
<circle bind:this={elementCircleOne} class="circle st18" cx="50" cy="87" r="5.4"/>
<circle bind:this={elementCircleTwo} class="circle st18" cx="49" cy="135" r="5.4"/>
<circle bind:this={elementCircleThree} class="circle st18" cx="218.2" cy="110" r="5.4"/>
</g> Finally, trigger each onMount(() => {
popup(elementCircleOne,{ /* ...popup settings here... */ });
// .. repeat for circle two/three
}) This will programmatically run Again, this is untested, but this hopefully this should help. Ideally though, you find a way to break up and make the interactive elements their own standalone DOM elements that are not contained within the SVG. That way you can use a proper interactive element, such as a button. This will provide the best a11y solution for your users. |
Beta Was this translation helpful? Give feedback.
-
Hi I'm experimenting with the floating-ui popups and have this working nicely:
However I need to add the on:click and use:popup to an existing inline SVG element. I'm struggling to work out how to do this. Is this possible and if so how ?
So I have these elements in my SVG:
Is it possible to programatically bind the
on:click={clear} use:popup={popupCloseQuery}
attributes to the existingcircle
elements in the SVG ?Beta Was this translation helpful? Give feedback.
All reactions