Skip to content

Commit

Permalink
👌 Change the default value for fallbackPlacements
Browse files Browse the repository at this point in the history
The default value for fallbackPlacements is [oppositePlacement] in
Popper (That does not flip the element if there is not enough space for
placing)
  • Loading branch information
rohit2sharma95 committed Dec 14, 2020
1 parent ebce95d commit 93b9289
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions js/src/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -81,7 +81,7 @@ const Default = {
selector: false,
placement: 'top',
container: false,
fallbackPlacements: null,
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents',
customClass: '',
sanitize: true,
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 93b9289

Please sign in to comment.