mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(ui): hide tooltips on close and dismiss buttons
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e614e680c0
commit
b1a20fabd4
@@ -7,8 +7,16 @@
|
||||
below: false,
|
||||
wrap: false,
|
||||
activeTarget: null,
|
||||
label(target) {
|
||||
return target.dataset.tooltip || target.getAttribute('aria-label') || target.title;
|
||||
},
|
||||
{{-- Close and dismiss (X) buttons are obvious, so they get no tooltip. --}}
|
||||
isDismiss(target) {
|
||||
return /^(close|dismiss)\b/i.test(this.label(target) || '');
|
||||
},
|
||||
isIconAction(target) {
|
||||
if (target.matches('[data-icon-tooltip-ignore]')) return false;
|
||||
if (this.isDismiss(target)) return false;
|
||||
if (target.matches('[data-tooltip], .icon-button')) return true;
|
||||
return target.hasAttribute('aria-label')
|
||||
&& target.childElementCount === 1
|
||||
@@ -16,9 +24,11 @@
|
||||
},
|
||||
prepare(root) {
|
||||
root.querySelectorAll?.('button[title], a[title], [data-tooltip]').forEach((target) => {
|
||||
if (!this.isIconAction(target)) return;
|
||||
target.dataset.iconTooltip = target.dataset.tooltip || target.getAttribute('aria-label') || target.title;
|
||||
if (!target.getAttribute('aria-label')) target.setAttribute('aria-label', target.dataset.iconTooltip);
|
||||
const dismiss = this.isDismiss(target);
|
||||
if (!dismiss && !this.isIconAction(target)) return;
|
||||
const label = this.label(target);
|
||||
if (!dismiss) target.dataset.iconTooltip = label;
|
||||
if (!target.getAttribute('aria-label')) target.setAttribute('aria-label', label);
|
||||
target.removeAttribute('title');
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user