Skip to content

Commit 27da76c

Browse files
fi(tooltip/popover): handle click blur on iOS webkit browsers (fixes #5099) (#5103)
* fi(tooltip/popover): handle `click blur` on iOS webkit browsers * Update bv-tooltip.js Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
1 parent e4d2671 commit 27da76c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
247247
this.clearVisibilityInterval()
248248
// Destroy the template
249249
this.destroyTemplate()
250+
// Remove any other private properties created during create
251+
this.$_noop = null
250252
},
251253
methods: {
252254
// --- Methods for creating and destroying the template ---
@@ -830,11 +832,20 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
830832
this.enable()
831833
}
832834
},
833-
click() {
835+
click(evt) {
834836
if (!this.$_enabled || this.dropdownOpen()) {
835837
/* istanbul ignore next */
836838
return
837839
}
840+
try {
841+
// Get around a WebKit bug where `click` does not trigger focus events
842+
// On most browsers, `click` triggers a `focusin`/`focus` event first
843+
// Needed so that trigger 'click blur' works on iOS
844+
// https://github.com/bootstrap-vue/bootstrap-vue/issues/5099
845+
// We use `currentTarget` rather than `target` to trigger on the
846+
// element, not the inner content
847+
evt.currentTarget.focus()
848+
} catch {}
838849
this.activeTrigger.click = !this.activeTrigger.click
839850
if (this.isWithActiveTrigger) {
840851
this.enter(null)

0 commit comments

Comments
 (0)