aboutsummaryrefslogtreecommitdiff
path: root/src/components/popover/popover.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-04-07 20:45:57 +0300
committerHenry Jameson <me@hjkos.com>2021-04-07 20:45:57 +0300
commit4e56e64034ce1e153ab2bbe3432ada89bdce09cd (patch)
tree791cbd7cf3cc9452bbf9b3dbc67fb35ae550dd50 /src/components/popover/popover.js
parent2da37f15ab6a7e0c6088a6e5a0b2c2885f1cb85a (diff)
parent8b96ea93776fd1eb462a7c54822d4f8ad6a9e776 (diff)
Merge remote-tracking branch 'origin/develop' into better-selects
* origin/develop: (76 commits) Translated using Weblate (Italian) Translated using Weblate (Basque) Translated using Weblate (Spanish) Translated using Weblate (Chinese (Simplified)) Translated using Weblate (Italian) Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Russian) Translated using Weblate (Italian) Translated using Weblate (French) Translated using Weblate (Russian) Translated using Weblate (Italian) Translated using Weblate (French) Translated using Weblate (Basque) Translated using Weblate (Spanish) Translated using Weblate (Chinese (Simplified)) Translated using Weblate (Japanese) Translated using Weblate (Italian) Translated using Weblate (Esperanto) Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Norwegian Bokmål) ...
Diffstat (limited to 'src/components/popover/popover.js')
-rw-r--r--src/components/popover/popover.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js
index 391d6422..bc6cd8e7 100644
--- a/src/components/popover/popover.js
+++ b/src/components/popover/popover.js
@@ -56,6 +56,9 @@ const Popover = {
// Popover will be anchored around this element, trigger ref is the container, so
// its children are what are inside the slot. Expect only one slot="trigger".
const anchorEl = (this.$refs.trigger && this.$refs.trigger.children[0]) || this.$el
+ // SVGs don't have offsetWidth/Height, use fallback
+ const anchorWidth = anchorEl.offsetWidth || anchorEl.clientWidth
+ const anchorHeight = anchorEl.offsetHeight || anchorEl.clientHeight
const screenBox = anchorEl.getBoundingClientRect()
// Screen position of the origin point for popover
const origin = { x: screenBox.left + screenBox.width * 0.5, y: screenBox.top }
@@ -114,11 +117,11 @@ const Popover = {
const yOffset = (this.offset && this.offset.y) || 0
const translateY = usingTop
- ? -anchorEl.offsetHeight + vPadding - yOffset - content.offsetHeight
+ ? -anchorHeight + vPadding - yOffset - content.offsetHeight
: yOffset
const xOffset = (this.offset && this.offset.x) || 0
- const translateX = (anchorEl.offsetWidth * 0.5) - content.offsetWidth * 0.5 + horizOffset + xOffset
+ const translateX = anchorWidth * 0.5 - content.offsetWidth * 0.5 + horizOffset + xOffset
// Note, separate translateX and translateY avoids blurry text on chromium,
// single translate or translate3d resulted in blurry text.