Loading core/modules/navigation/js/tooltip.js +15 −5 Changes for core/modules/navigation/js/tooltip.js: 15 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -29,10 +29,20 @@ * @return {HTMLElement} * A DOM Node. */ Drupal.theme.tooltipWrapper = (dataset) => `<div class="toolbar-tooltip ${dataset.drupalTooltipClass || ''}"> ${dataset.drupalTooltip} </div>`; Drupal.theme.tooltipWrapper = (dataset) => { const el = document.createElement('div'); el.classList.add('toolbar-tooltip'); if (dataset.drupalTooltipClass) { dataset.drupalTooltipClass .split(/\s+/) .filter((token) => token !== '') .forEach((token) => { el.classList.add(token); }); } el.textContent = dataset.drupalTooltip || ''; return el; }; /** * Attaches the tooltip behavior to all required triggers. Loading @@ -46,7 +56,7 @@ attach: (context) => { once('tooltip-trigger', '[data-drupal-tooltip]', context).forEach( (trigger) => { trigger.insertAdjacentHTML( trigger.insertAdjacentElement( 'afterend', Drupal.theme.tooltipWrapper(trigger.dataset), ); Loading core/modules/navigation/navigation.libraries.yml +1 −0 Changes for core/modules/navigation/navigation.libraries.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ internal.tooltip: base: css/components/tooltip.css: {} dependencies: - core/drupal - core/once - core/internal.floating-ui Loading Loading
core/modules/navigation/js/tooltip.js +15 −5 Changes for core/modules/navigation/js/tooltip.js: 15 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -29,10 +29,20 @@ * @return {HTMLElement} * A DOM Node. */ Drupal.theme.tooltipWrapper = (dataset) => `<div class="toolbar-tooltip ${dataset.drupalTooltipClass || ''}"> ${dataset.drupalTooltip} </div>`; Drupal.theme.tooltipWrapper = (dataset) => { const el = document.createElement('div'); el.classList.add('toolbar-tooltip'); if (dataset.drupalTooltipClass) { dataset.drupalTooltipClass .split(/\s+/) .filter((token) => token !== '') .forEach((token) => { el.classList.add(token); }); } el.textContent = dataset.drupalTooltip || ''; return el; }; /** * Attaches the tooltip behavior to all required triggers. Loading @@ -46,7 +56,7 @@ attach: (context) => { once('tooltip-trigger', '[data-drupal-tooltip]', context).forEach( (trigger) => { trigger.insertAdjacentHTML( trigger.insertAdjacentElement( 'afterend', Drupal.theme.tooltipWrapper(trigger.dataset), ); Loading
core/modules/navigation/navigation.libraries.yml +1 −0 Changes for core/modules/navigation/navigation.libraries.yml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ internal.tooltip: base: css/components/tooltip.css: {} dependencies: - core/drupal - core/once - core/internal.floating-ui Loading