From 32d661560d4d95dc308f25d0a405b502fa94ade2 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Sat, 11 Dec 2021 01:39:46 +0200 Subject: [PATCH 1/2] Popover/Tooltip: Fix vertical alignment on arrow of tip elements Regression of #32692 --- js/src/tooltip.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 94c3935bd953..c992aa91d3ca 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 placement in order to read properly the arrow sizes. + // In other way it messes the width vs height as the initial arrow style is for top placement // FIX wording + 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) From ac5b713c1ab8dbeefa3cfefd570b0c513235614c Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 21 Dec 2021 16:48:04 +0200 Subject: [PATCH 2/2] Update tooltip.js --- js/src/tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/tooltip.js b/js/src/tooltip.js index c992aa91d3ca..aa54371e7e4a 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -455,8 +455,8 @@ class Tooltip extends BaseComponent { enabled: true, phase: 'beforeMain', fn: data => { - // pre-set Popper placement in order to read properly the arrow sizes. - // In other way it messes the width vs height as the initial arrow style is for top placement // FIX wording + // 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) } }