]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add examples of disabled tooltip and popover triggers
authorMark Otto <markdotto@gmail.com>
Thu, 28 Dec 2017 01:07:58 +0000 (17:07 -0800)
committerMark Otto <markd.otto@gmail.com>
Thu, 28 Dec 2017 18:26:43 +0000 (10:26 -0800)
docs/4.0/components/popovers.md
docs/4.0/components/tooltips.md

index 808239314cd439e063e15a94be059b11713c8957..fef7bd96ea4d6d0d23a486758f42b9a31fb37634 100644 (file)
@@ -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
 
index 2ea4c91cc43c13ef37d0857eb961139eacde21e1..f04c65df3df1bd1cbbcff8712153d21c2766a97e 100644 (file)
@@ -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=""`.