diff --git a/web_src/js/modules/tippy.js b/web_src/js/modules/tippy.js index 6cec95d766..3a8c7e09c2 100644 --- a/web_src/js/modules/tippy.js +++ b/web_src/js/modules/tippy.js @@ -1,5 +1,7 @@ import tippy from 'tippy.js'; +const visibleInstances = new Set(); + export function createTippy(target, opts = {}) { const instance = tippy(target, { appendTo: document.body, @@ -9,6 +11,18 @@ export function createTippy(target, opts = {}) { interactiveBorder: 20, ignoreAttributes: true, maxWidth: 500, // increase over default 350px + onHide: (instance) => { + visibleInstances.delete(instance); + }, + onDestroy: (instance) => { + visibleInstances.delete(instance); + }, + onShow: (instance) => { + for (const visibleInstance of visibleInstances) { + visibleInstance.hide(); // hide other instances + } + visibleInstances.add(instance); + }, arrow: ``, ...(opts?.role && {theme: opts.role}), ...opts,