Merge pull request #21995 from overleaf/mf-disable-footer-tooltip-if-element-is-not-available

[web] Only trigger footer tooltip if target element is available

GitOrigin-RevId: e0aff735243369a0d2180174231951054f1ee533
This commit is contained in:
M Fahru
2024-11-20 10:42:58 -07:00
committed by Copybot
parent eefa0a792a
commit 16e65edd0d

View File

@@ -14,19 +14,18 @@ function getElementWidth(el: Element) {
const footerLanguageElement = document.querySelector(
'[data-ol-lang-selector-tooltip]'
) as Element
if (footerLanguageElement) {
// eslint-disable-next-line no-new
new Tooltip(footerLanguageElement)
}
const allTooltips = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const possibleBadgeTooltips = document.querySelectorAll('[data-badge-tooltip]')
// eslint-disable-next-line no-unused-vars
const footLangTooltip = new Tooltip(footerLanguageElement)
allTooltips.forEach(element => {
// eslint-disable-next-line no-unused-vars
const tooltip = new Tooltip(element)
})
const possibleBadgeTooltips = document.querySelectorAll('[data-badge-tooltip]')
possibleBadgeTooltips.forEach(element => {
// Put data-badge-tooltip on .badge-content
// then tooltip is only shown if content is clipped due to max-width on .badge