aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2021-12-21 17:19:29 +0200
committerGitHub <[email protected]>2021-12-21 17:19:29 +0200
commit65cf77ae3ef676a5d9e2ea640393ec8055e8b953 (patch)
tree28a9112109eceb1298482a85fec0d53ca17786ba
parentaec213711ae25ecdf0431e6ac90a4561cafce238 (diff)
downloadbootstrap-65cf77ae3ef676a5d9e2ea640393ec8055e8b953.tar.xz
bootstrap-65cf77ae3ef676a5d9e2ea640393ec8055e8b953.zip
Popover/Tooltip: Fix vertical alignment on arrow of tip elements (#35527)
Regression of #32692 Co-authored-by: XhmikosR <[email protected]>
-rw-r--r--js/src/tooltip.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 94c3935bd..aa54371e7 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -449,6 +449,16 @@ class Tooltip extends BaseComponent {
options: {
element: `.${this.constructor.NAME}-arrow`
}
+ },
+ {
+ name: 'preSetPlacement',
+ enabled: true,
+ phase: 'beforeMain',
+ fn: data => {
+ // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
+ // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
+ this._getTipElement().setAttribute('data-popper-placement', data.state.placement)
+ }
}
]
}
@@ -624,7 +634,6 @@ class Tooltip extends BaseComponent {
}
// Static
-
static jQueryInterface(config) {
return this.each(function () {
const data = Tooltip.getOrCreateInstance(this, config)