Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tooltip+popover): add boundary config option #24979

Merged
merged 17 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/4.0/components/popovers.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>Allow to specify which position Popper will use on fallback. For more information refer to
Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..flip.behavior">behavior docs</a></td>
</tr>
<tr>
<td>boundary</td>
<td>string | element</td>
<td>'scrollParent'</td>
<td>Overflow constraint boundary of the popover. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td>
</tr>
</tbody>
</table>

Expand Down
6 changes: 6 additions & 0 deletions docs/4.0/components/tooltips.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
<td>Allow to specify which position Popper will use on fallback. For more information refer to
Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..flip.behavior">behavior docs</a></td>
</tr>
<tr>
<td>boundary</td>
<td>string | element</td>
<td>'scrollParent'</td>
<td>Overflow constraint boundary of the tooltip. Accepts the values of <code>'viewport'</code>, <code>'window'</code>, <code>'scrollParent'</code>, or an HTMLElement reference (JavaScript only). For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..preventOverflow.boundariesElement">preventOverflow docs</a>.</td>
</tr>
</tbody>
</table>

Expand Down
9 changes: 7 additions & 2 deletions js/src/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -62,7 +63,8 @@ const Tooltip = (($) => {
placement : 'top',
offset : 0,
container : false,
fallbackPlacement : 'flip'
fallbackPlacement : 'flip',
boundary : 'scrollParent'
}

const HoverState = {
Expand Down Expand Up @@ -301,6 +303,9 @@ const Tooltip = (($) => {
},
arrow: {
element: Selector.ARROW
},
preventOverflow: {
boundariesElement: this.config.boundary
}
},
onCreate: (data) => {
Expand Down