v5: Tooltips with data-bs-title not working
Created by: masi
If I want to code my HTML with data-bs-title instead of title this does not work as described in the docs.
IMHO the reason is _fixTitle(). If the element has no title attribute and no data-bs-original-title with string data then the title attribute is forced to an empty string, but data-bs-original-title is NOT set to the value of data-bs-title.
_fixTitle() {
const title = this._element.getAttribute('title')
const originalTitleType = typeof this._element.getAttribute('data-bs-original-title')
if (title || originalTitleType !== 'string') {
this._element.setAttribute('data-bs-original-title', title || '')
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
this._element.setAttribute('aria-label', title)
}
this._element.setAttribute('title', '')
}
}
What is missing here is that the title takes data-bs-title into consideration.