Skip to content

Commit 868d059

Browse files
committed
destructure all the things
1 parent 2768846 commit 868d059

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

web_src/js/modules/tippy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import tippy from 'tippy.js';
22

33
const visibleInstances = new Set();
44

5-
export function createTippy(target, opts = {}) {
6-
const {onHide, onShow, onDestroy, ...other} = opts;
5+
export function createTippy(target, {onHide, onShow, onDestroy, role, content, ...other} = {}) {
76
const instance = tippy(target, {
87
appendTo: document.body,
98
animation: false,
@@ -32,15 +31,16 @@ export function createTippy(target, opts = {}) {
3231
},
3332
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
3433
role: 'menu', // HTML role attribute, only tooltips should use "tooltip"
35-
theme: other.role || 'menu', // CSS theme, we support either "tooltip" or "menu"
34+
theme: role || 'menu', // CSS theme, we support either "tooltip" or "menu"
35+
content,
3636
...other,
3737
});
3838

3939
// for popups where content refers to a DOM element, we use the 'tippy-target' class
4040
// to initially hide the content, now we can remove it as the content has been removed
4141
// from the DOM by tippy
42-
if (other.content instanceof Element) {
43-
other.content.classList.remove('tippy-target');
42+
if (content instanceof Element) {
43+
content.classList.remove('tippy-target');
4444
}
4545

4646
return instance;

0 commit comments

Comments
 (0)