diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 103524b8b49f..63a30cf2fbd2 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -51,7 +51,7 @@ const DefaultType = { selector: '(string|boolean)', placement: '(string|function)', container: '(string|element|boolean)', - fallbackPlacements: '(null|array)', + fallbackPlacements: 'array', boundary: '(string|element)', customClass: '(string|function)', sanitize: 'boolean', @@ -81,7 +81,7 @@ const Default = { selector: false, placement: 'top', container: false, - fallbackPlacements: null, + fallbackPlacements: ['top', 'right', 'bottom', 'left'], boundary: 'clippingParents', customClass: '', sanitize: true, @@ -466,22 +466,16 @@ class Tooltip extends BaseComponent { // Private _getPopperConfig(attachment) { - const flipModifier = { - name: 'flip', - options: { - altBoundary: true, - fallbackPlacements: ['top', 'right', 'bottom', 'left'] - } - } - - if (this.config.fallbackPlacements) { - flipModifier.options.fallbackPlacements = this.config.fallbackPlacements - } - const defaultBsConfig = { placement: attachment, modifiers: [ - flipModifier, + { + name: 'flip', + options: { + altBoundary: true, + fallbackPlacements: this.config.fallbackPlacements + } + }, { name: 'preventOverflow', options: { diff --git a/site/content/docs/5.0/components/popovers.md b/site/content/docs/5.0/components/popovers.md index 0b468833d42d..0c6118790c60 100644 --- a/site/content/docs/5.0/components/popovers.md +++ b/site/content/docs/5.0/components/popovers.md @@ -249,9 +249,9 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt fallbackPlacements - string | array - 'flip' - Allow to specify which position Popper will use on fallback. For more information refer to + array + ['top', 'right', 'bottom', 'left'] + Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper's behavior docs diff --git a/site/content/docs/5.0/components/tooltips.md b/site/content/docs/5.0/components/tooltips.md index 6f0bde9dc9e0..21becc626049 100644 --- a/site/content/docs/5.0/components/tooltips.md +++ b/site/content/docs/5.0/components/tooltips.md @@ -254,9 +254,9 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt fallbackPlacements - null | array - null - Allow to specify which position Popper will use on fallback. For more information refer to + array + ['top', 'right', 'bottom', 'left'] + Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper's behavior docs diff --git a/site/content/docs/5.0/migration.md b/site/content/docs/5.0/migration.md index c32dcfab9201..05bf4770588f 100644 --- a/site/content/docs/5.0/migration.md +++ b/site/content/docs/5.0/migration.md @@ -7,6 +7,12 @@ aliases: "/migration/" toc: true --- +## v5.0.0-beta2 + +### JavaScript + +- The default value for the `fallbackPlacements` is changed to `['top', 'right', 'bottom', 'left']` for better placement of popper elements. + ## v5.0.0-beta1 ### RTL