Skip to content

GitLab UI tooltips in HAML/Vanilla JS: Dispose tooltips

What does this MR do?

This Merge Request continues the work started in !36452 (merged). This MR has two goals:

  • Disposing tooltips when the tooltip’s target is removed from the document.
  • Providing an API to dispose tooltips manually.

How to test?

Replace the following snippet in app/assets/javascripts/main.js:

  // Initialize tooltips
  $body.tooltip({
    selector: '.has-tooltip, [data-toggle="tooltip"]',
    trigger: 'hover',
    boundary: 'viewport',
    delay,
  });

with

  initTooltips('.has-tooltip, [data-toggle="tooltip"]:not([data-original-title])', {
    triggers: 'hover',
    boundary: 'viewport',
  });

Try removing an element that has a tooltip attached. When you do that, you can use Vue devtools in Chrome or Firefox to verify that the related tooltip was removed.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Merge request reports

Loading