Skip to content

Commit d7a11f2

Browse files
wxiaoguangsilverwind
authored andcommitted
revert tippy default theme
1 parent 3f5459a commit d7a11f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web_src/js/modules/tippy.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import tippy from 'tippy.js';
33
const visibleInstances = new Set();
44

55
export function createTippy(target, opts = {}) {
6+
// do not use "tooltip" (tippy's default),
7+
// otherwise the "auto hide tooltip" mechanism would cause tippy popups without role (default to tooltip) been incorrectly hidden.
8+
if (!opts.role) opts.role = 'menu';
69
const instance = tippy(target, {
710
appendTo: document.body,
811
animation: false,
@@ -27,7 +30,7 @@ export function createTippy(target, opts = {}) {
2730
visibleInstances.add(instance);
2831
},
2932
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>`,
30-
role: 'menu',
33+
...(opts?.role && {theme: opts.role}),
3134
...opts,
3235
});
3336

@@ -68,7 +71,6 @@ function attachTooltip(target, content = null) {
6871
content,
6972
delay: 100,
7073
role: 'tooltip',
71-
theme: 'tooltip',
7274
hideOnClick,
7375
placement: target.getAttribute('data-tooltip-placement') || 'top-start',
7476
...(target.getAttribute('data-tooltip-interactive') === 'true' ? {interactive: true, aria: {content: 'describedby', expanded: false}} : {}),

0 commit comments

Comments
 (0)