mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 15:50:01 +02:00
Rewrite some callouts to remove most headings and reduce their content
This commit is contained in:
@@ -135,9 +135,7 @@ As part of Bootstrap’s evolving CSS variables approach, tooltips now use local
|
||||
|
||||
## Usage
|
||||
|
||||
The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element.
|
||||
|
||||
Trigger the tooltip via JavaScript:
|
||||
The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. Trigger the tooltip via JavaScript:
|
||||
|
||||
```js
|
||||
const exampleEl = document.getElementById('example')
|
||||
@@ -145,9 +143,7 @@ const tooltip = new bootstrap.Tooltip(exampleEl, options)
|
||||
```
|
||||
|
||||
{{< callout warning >}}
|
||||
##### Overflow `auto` and `scroll`
|
||||
|
||||
Tooltip position attempts to automatically change when a **parent container** has `overflow: auto` or `overflow: scroll` like our `.table-responsive`, but still keeps the original placement's positioning. To resolve this, set the [`boundary` option](https://popper.js.org/docs/v2/modifiers/flip/#boundary) (for the flip modifier using the `popperConfig` option) to any HTMLElement to override the default value, `'clippingParents'`, such as `document.body`:
|
||||
Tooltips automatically attempt to change positions when a parent container has `overflow: auto` or `overflow: scroll`, but still keeps the original placement's positioning. Set the [`boundary` option](https://popper.js.org/docs/v2/modifiers/flip/#boundary) (for the flip modifier using the `popperConfig` option) to any HTMLElement to override the default value, `'clippingParents'`, such as `document.body`:
|
||||
|
||||
```js
|
||||
const tooltip = new bootstrap.Tooltip('#example', {
|
||||
@@ -161,9 +157,7 @@ const tooltip = new bootstrap.Tooltip('#example', {
|
||||
The required markup for a tooltip is only a `data` attribute and `title` on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to `top` by the plugin).
|
||||
|
||||
{{< callout warning >}}
|
||||
##### Making tooltips work for keyboard and assistive technology users
|
||||
|
||||
You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as `<span>`s) can be made focusable by adding the `tabindex="0"` attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the tooltip in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltip, as this will make your tooltips impossible to trigger for keyboard users.
|
||||
**Keep tooltips accessible to keyboard and assistive technology users** by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding `tabindex="0"`, this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce tooltips in this situation. Additionally, do not rely solely on `hover` as the trigger for your tooltips as this will make theme impossible to trigger for keyboard users.
|
||||
{{< /callout >}}
|
||||
|
||||
```html
|
||||
|
Reference in New Issue
Block a user