diff --git a/docs/4.0/components/popovers.md b/docs/4.0/components/popovers.md index 9f0472e3e365..f50084708906 100644 --- a/docs/4.0/components/popovers.md +++ b/docs/4.0/components/popovers.md @@ -264,6 +264,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap Allow to specify which position Popper will use on fallback. For more information refer to Popper.js's behavior docs + + boundary + string | element + 'scrollParent' + Overflow constraint boundary of the popover. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's preventOverflow docs. + diff --git a/docs/4.0/components/tooltips.md b/docs/4.0/components/tooltips.md index 766b726ed3da..d0ef70183547 100644 --- a/docs/4.0/components/tooltips.md +++ b/docs/4.0/components/tooltips.md @@ -244,6 +244,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap Allow to specify which position Popper will use on fallback. For more information refer to Popper.js's behavior docs + + boundary + string | element + 'scrollParent' + Overflow constraint boundary of the tooltip. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's preventOverflow docs. + diff --git a/js/src/tooltip.js b/js/src/tooltip.js index 573997e7da2d..e348fdf20836 100644 --- a/js/src/tooltip.js +++ b/js/src/tooltip.js @@ -38,7 +38,8 @@ const Tooltip = (($) => { placement : '(string|function)', offset : '(number|string)', container : '(string|element|boolean)', - fallbackPlacement : '(string|array)' + fallbackPlacement : '(string|array)', + boundary : '(string|element)' } const AttachmentMap = { @@ -62,7 +63,8 @@ const Tooltip = (($) => { placement : 'top', offset : 0, container : false, - fallbackPlacement : 'flip' + fallbackPlacement : 'flip', + boundary : 'scrollParent' } const HoverState = { @@ -301,6 +303,9 @@ const Tooltip = (($) => { }, arrow: { element: Selector.ARROW + }, + preventOverflow: { + boundariesElement: this.config.boundary } }, onCreate: (data) => {