diff options
| author | Mark Otto <[email protected]> | 2017-12-27 17:07:58 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2017-12-28 10:26:43 -0800 |
| commit | 3e0dd5a5d7b138a2bdbcbf203ac18faec9805c7a (patch) | |
| tree | 8f68ef0ed78cb433aaa050554a4f1736e5dc9e57 /docs | |
| parent | dd621e5511ad49e38e55fa6ab1b908c0a3883fe5 (diff) | |
| download | bootstrap-3e0dd5a5d7b138a2bdbcbf203ac18faec9805c7a.tar.xz bootstrap-3e0dd5a5d7b138a2bdbcbf203ac18faec9805c7a.zip | |
Add examples of disabled tooltip and popover triggers
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/4.0/components/popovers.md | 11 | ||||
| -rw-r--r-- | docs/4.0/components/tooltips.md | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/docs/4.0/components/popovers.md b/docs/4.0/components/popovers.md index 808239314..fef7bd96e 100644 --- a/docs/4.0/components/popovers.md +++ b/docs/4.0/components/popovers.md @@ -111,6 +111,17 @@ $('.popover-dismiss').popover({ }) {% endhighlight %} +### Disabled elements + +Elements with the `disabled` attribute aren't interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you'll want to trigger the popover from a wrapper `<div>` or `<span>` and override the `pointer-events` on the disabled element. + +For disabled popover triggers, you may also prefer `data-trigger="hover"` so that the popover appears as immediate visual feedback to your users as they may not expect to _click_ on a disabled element. + +{% example html %} +<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover"> + <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button> +</span> +{% endexample %} ## Usage diff --git a/docs/4.0/components/tooltips.md b/docs/4.0/components/tooltips.md index 2ea4c91cc..f04c65df3 100644 --- a/docs/4.0/components/tooltips.md +++ b/docs/4.0/components/tooltips.md @@ -109,6 +109,18 @@ You should only add tooltips to HTML elements that are traditionally keyboard-fo </div> {% endhighlight %} +### Disabled elements + +Elements with the `disabled` attribute aren't interactive, meaning users cannot hover or click them to trigger a tooltip (or popover). As a workaround, you'll want to trigger the tooltip from a wrapper `<div>` or `<span>` and override the `pointer-events` on the disabled element. + +<div class="tooltip-demo"> +{% example html %} +<span class="d-inline-block" data-toggle="tooltip" title="Disabled tooltip"> + <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button> +</span> +{% endexample %} +</div> + ### Options Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-animation=""`. |
