Comments (4)
Is there an easy solution to make vue3-popper work with SVG ?
Unfortunately for your case, I don't think so since Popper is currently unable to be "renderless" as in not rendering any element except the one that it wraps. I don't know if that's even possible.
SVGs can have HTML in them using <foreignObject/>
according to Google 😄 but I don't know anything more about that.
Thanks for the reproduction, I cloned your repo and it's an interesting problem, I just don't see the solution at the moment.
from vue3-popper.
@valgeirb thanks for the quick reply!
We have used foreignObject but as far as I can tell it requires to fix position and size, which is complicated here. The best would be to place the additional HTML elements outside the SVG.
Do you think it would be feasible to create a <PopperDetached>
component to be used like this:
<template>
<PopperDetached
v-for="(d, name) in districts"
:key="name"
:hover="true"
:trigger="name">
<template #content>
...
</template>
</PopperDetached>
<svg
...
>
<g>
<path
v-for="(d, name) in districts"
:key="name"
:id="name"
...
/>
</g>
</svg>
</template>
(based on the non-working code here: https://gitlab.com/simevo/vue3-svg-map/-/blob/vue3-popper/src/components/MapMaharashtra.vue)
Notice the trigger
prop which is used to pass the id of the SVG element that actually triggers the popper.
from vue3-popper.
I have a similar use case that I'd love an implementation for. Any update here? The PopperDetached
option @simevo mentions would work fine for us too.
from vue3-popper.
Had a similar issue, and solved it using foreignObject
(to allow nested HTML in the svg) and Teleport
(to move the tooltip to a place in the DOM outside the svg.
from vue3-popper.
Related Issues (20)
- popper always in top HOT 2
- [Question] How can I stop clicking the target again from closing the popper HOT 1
- Interface props isn't exported. HOT 2
- Default styling is very broken HOT 8
- Can't put several children
- Prevent form submit when popper used inside the form
- Clicking the target shouldn't close the popper if in hover mode
- Feature request - Popper strategy parameter HOT 2
- preventOverflow missing HOT 2
- Landing page / Docs: "Guide" hyperlink goes to page with 404 message
- Offset overlap prevents from showing the tooltip on hover HOT 1
- [Question] Align dropdown to the right of trigger element
- When ı switched pages to quickly popper wasn't disconnect HOT 3
- Popper doesn't close when tapping outside of popper on iOS
- Provide access to update method HOT 1
- Repeated id when using several poppers in the same page - accessibility enhancement
- Issue with disableClickAway.
- [Feature request]: Window offset
- Emit on direction changing
- [Question] Always one on the screen
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue3-popper.