Skip to content

Commit 9137cd2

Browse files
committed
fix: Fix interactions with tooltip content, #17
1 parent 5b0b9b3 commit 9137cd2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Tooltip.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class Tooltip {
162162
.wait(this.#contentSelector, null, { events: [DOMObserver.EXIST, DOMObserver.ADD] })
163163
.then(({ node }) => {
164164
const child = this.#contentClone ? node.cloneNode(true) : node
165+
child.setAttribute('style', 'position: relative')
165166
this.#tooltip.appendChild(child)
166167
})
167168
} else if (this.#content) {
@@ -173,7 +174,7 @@ class Tooltip {
173174
}
174175

175176
#createAndAddTooltipArea() {
176-
const area = document.createElement('div')
177+
const area = document.createElement('span')
177178
area.setAttribute('aria-hidden', 'true')
178179
area.setAttribute('class', '__tooltip-area')
179180
switch (this.#position) {
@@ -252,7 +253,7 @@ class Tooltip {
252253
const trigger = key === '*' ? this.#tooltip : this.#tooltip.querySelector(key)
253254
if (trigger) {
254255
const listener = (event) => {
255-
callback?.apply(null, [...callbackParams, event])
256+
callback?.apply(null, [...(callbackParams || []), event])
256257
if (closeOnCallback) {
257258
this.#removeTooltipFromTarget()
258259
}

0 commit comments

Comments
 (0)