]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Tooltip: a simple code-block position change
authorGeoSot <geo.sotis@gmail.com>
Mon, 29 Nov 2021 14:16:42 +0000 (16:16 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 1 Dec 2021 16:00:36 +0000 (18:00 +0200)
js/src/tooltip.js

index fc96812b460efc10346ea7be65aae9d490f9e6f7..5fd1927c9e07a6e2c084fbb622e34e922d2df915 100644 (file)
@@ -274,27 +274,12 @@ class Tooltip extends BaseComponent {
       return
     }
 
-    const tip = this.getTipElement()
-    const complete = () => {
-      if (this._isWithActiveTrigger()) {
-        return
-      }
-
-      if (!this._isHovered) {
-        tip.remove()
-      }
-
-      this._element.removeAttribute('aria-describedby')
-      EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
-
-      this._disposePopper()
-    }
-
     const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)
     if (hideEvent.defaultPrevented) {
       return
     }
 
+    const tip = this.getTipElement()
     tip.classList.remove(CLASS_NAME_SHOW)
 
     // If this is a touch-enabled device we remove the extra
@@ -309,6 +294,21 @@ class Tooltip extends BaseComponent {
     this._activeTrigger[TRIGGER_FOCUS] = false
     this._activeTrigger[TRIGGER_HOVER] = false
 
+    const complete = () => {
+      if (this._isWithActiveTrigger()) {
+        return
+      }
+
+      if (!this._isHovered) {
+        tip.remove()
+      }
+
+      this._element.removeAttribute('aria-describedby')
+      EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
+
+      this._disposePopper()
+    }
+
     this._queueCallback(complete, this.tip, this._isAnimated())
     this._isHovered = false
   }