aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRohit Sharma <[email protected]>2020-12-15 00:21:14 +0530
committerGitHub <[email protected]>2020-12-14 20:51:14 +0200
commit042a4a255f3c994ee8285df9a14fe0fbd95df83c (patch)
tree65c8bfa43156398a35e0828dcefaebd4b7bb83f5 /js
parent793c79d14b26c4de2198bc4c6d6861e1d420ed76 (diff)
downloadbootstrap-042a4a255f3c994ee8285df9a14fe0fbd95df83c.tar.xz
bootstrap-042a4a255f3c994ee8285df9a14fe0fbd95df83c.zip
Tooltip/popover - change the default value for `fallbackPlacements` (#32437)
The default Popper `fallbackPlacements` value is `[oppositePlacement]`. - The default value was previously (in v4) `'flip'` that can be achieved by passing the single value in the array, like — `[oppositePlacement]`. Keeping `null` also sets the `fallbackPlacements` to `[oppositePlacement]` (Default value in Popper) - It's better to have **clockwise** (`['top', 'right', 'bottom', 'left']`) fallback options so that tooltip/popover can be placed to another side even if the opposite placement doesn't fit. Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js')
-rw-r--r--js/src/tooltip.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 103524b8b..63a30cf2f 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: {