diff --git a/docs/4.0/components/popovers.md b/docs/4.0/components/popovers.md index 9f0472e3e..f50084708 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 766b726ed..d0ef70183 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 573997e7d..e348fdf20 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) => {