Skip to content

Commit 2dd8d5a

Browse files
authored
fix(tooltip, popover): hide trigger element title attribute during show delay (fixes #4114) (#4120)
1 parent d9900ab commit 2dd8d5a

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/components/tooltip/helpers/bv-tooltip.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
413413
// Hide the tooltip
414414
const tip = this.getTemplateElement()
415415
if (!tip || !this.localShow) {
416+
/* istanbul ignore next */
417+
this.restoreTitle()
416418
/* istanbul ignore next */
417419
return
418420
}
@@ -613,7 +615,7 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
613615
const target = this.getTarget()
614616
if (target && hasAttr(target, 'data-original-title')) {
615617
setAttr(target, 'title', getAttr(target, 'data-original-title') || '')
616-
setAttr(target, 'data-original-title', '')
618+
removeAttr(target, 'data-original-title')
617619
}
618620
},
619621
//
@@ -886,9 +888,14 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
886888
if (!this.computedDelay.show) {
887889
this.show()
888890
} else {
891+
// Hide any title attribute while enter delay is active
892+
this.fixTitle()
889893
this.hoverTimeout = setTimeout(() => {
894+
/* istanbul ignore else */
890895
if (this.$_hoverState === 'in') {
891896
this.show()
897+
} else if (!this.localShow) {
898+
this.restoreTitle()
892899
}
893900
}, this.computedDelay.show)
894901
}

src/directives/popover/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ Where `[mod]` can be (all optional):
446446
- `nofade` to turn off animation.
447447
- `html` to enable rendering raw HTML. by default HTML is escaped and converted to text.
448448
- A delay value in the format of `d###` (where `###` is in ms, defaults to `50`), applied to both
449-
`hide` and `show` (affects `hover` and `focus` only)
449+
`hide` and `show`.
450450
- A show delay value in the format of `ds###` (where `###` is in ms, defaults to `50`), applied to
451-
`show` trigger only (affects `hover` and `focus` only)
451+
`show` trigger only.
452452
- A hide delay value in the format of `dh###` (where `###` is in ms, defaults to `50`), applied to
453-
`hide` trigger only (affects `hover` and `focus` only)
453+
`hide` trigger only.
454454
- An offset value in pixels in the format of `o###` (where `###` is the number of pixels, defaults
455455
to `0`. Negative values are allowed). Note if an offset is supplied, then the alignment positions
456456
will fallback to one of `top`, `bottom`, `left`, or `right`.

src/directives/tooltip/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -309,24 +309,24 @@ Where `[modX]` can be (all optional):
309309

310310
- Positioning: `top`, `bottom`, `left`, `right`, `auto`, `topleft`, `topright`, `bottomleft`,
311311
`bottomright`, `lefttop`, `leftbottom`, `righttop`, or `rightbottom` (last one found wins,
312-
defaults to `top`)
312+
defaults to `top`).
313313
- Event trigger: `click`, `hover`, `focus`, `blur` (if none specified, defaults to `focus` and
314314
`hover`. `blur` is a close handler only, and if specified by itself, will be converted to
315315
`focus`). Use `manual` if you only want to control the visibility manually.
316-
- `nofade` to turn off animation
316+
- `nofade` to turn off animation.
317317
- `html` to enable rendering raw HTML. By default HTML is escaped and converted to text
318318
- A delay value in the format of `d###` (where `###` is in ms, defaults to `50`), applied to both
319-
`hide` and `show` (affects `hover` and `focus` only)
319+
`hide` and `show`.
320320
- A show delay value in the format of `ds###` (where `###` is in ms, defaults to `50`), applied to
321-
`show` trigger only (affects `hover` and `focus` only)
321+
`show` trigger only.
322322
- A hide delay value in the format of `dh###` (where `###` is in ms, defaults to `50`), applied to
323-
`hide` trigger only (affects `hover` and `focus` only)
323+
`hide` trigger only.
324324
- An offset value in pixels in the format of `o###` (where `###` is the number of pixels, defaults
325-
to `0`. Negative values allowed)
325+
to `0`. Negative values allowed).
326326
- A boundary setting of `window` or `viewport`. The element to constrain the visual placement of the
327327
tooltip. If not specified, the boundary defaults to the trigger element's scroll parent (in most
328-
cases this will suffice)
329-
- A contextual variant in the form of `v-XXX` (where `XXX` is the color variant name)
328+
cases this will suffice).
329+
- A contextual variant in the form of `v-XXX` (where `XXX` is the color variant name).
330330

331331
Where `<value>` can be (optional):
332332

0 commit comments

Comments
 (0)