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
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done