diff options
| -rw-r--r-- | js/src/dropdown.js | 4 | ||||
| -rw-r--r-- | js/src/tooltip.js | 12 | ||||
| -rw-r--r-- | js/tests/visual/popover.html | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js index d678a3a02..613a23812 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -65,8 +65,8 @@ const Dropdown = (($) => { } const AttachmentMap = { - TOP : 'top', - BOTTOM : 'bottom' + TOP : 'top-start', + BOTTOM : 'bottom-start' } const Default = { diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 2c34ac5d7..b446d9bcc 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -287,6 +287,12 @@ const Tooltip = (($) => { offset : { offset : this.config.offset } + }, + onCreate : (data) => { + this._handlePopperPlacementChange(data) + }, + onUpdate : (data) => { + this._handlePopperPlacementChange(data) } }) @@ -637,6 +643,12 @@ const Tooltip = (($) => { } } + _handlePopperPlacementChange(data) { + if (data.originalPlacement !== data.placement) { + this._cleanTipClass() + this.addAttachmentClass(this._getAttachment(data.placement)) + } + } // static diff --git a/js/tests/visual/popover.html b/js/tests/visual/popover.html index 4fd813c06..93fa01f9d 100644 --- a/js/tests/visual/popover.html +++ b/js/tests/visual/popover.html @@ -10,7 +10,7 @@ <div class="container"> <h1>Popover <small>Bootstrap Visual Test</small></h1> - <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus."> + <button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Default placement was on top but not enough place"> Popover on top </button> |
