Skip to content

Commit

Permalink
chore(tooltip): updated documentation for self-managed tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
TarunAdobe committed Nov 28, 2023
1 parent 590d28b commit 0a8e022
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/tooltip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ You can use the tooltip as the descendant of an interactive element, such as [Ac
This is especially useful when inserting an intermediate `<overlay-trigger>` would interfere with
parent/child relationships, such as between `<sp-action-group>` and `<sp-action-button>`.

Note that tooltip would not work with a non-interactive element, such as `<sp-icon-*>`, The right way to do this is to wrap the icon in an button-like element, such as `<sp-action-button>`:
Note that tooltip would not be accessible if used with a non-interactive element, such as `<sp-icon-*>`.
If we use tab navigation to focus on the icon, the tooltip would not be shown. This is because the tooltip is not a focusable element by itself, and the icon is not interactive. Thus, it is advised to wrap the icon in an interactive element, such as `<sp-action-button>`.

The correct way to make it accessible would be to wrap the icon by a focusable element, such as `<sp-action-button>`:

```html
<sp-action-button size="s">
Expand All @@ -69,8 +72,6 @@ Note that tooltip would not work with a non-interactive element, such as `<sp-ic
</sp-action-button>
```

The reason why tooltip does not work with non-interactive elements is that if someone uses tab navigation to focus on the icon, the tooltip would not be shown. This is because the tooltip is not a focusable element, and the icon is not interactive. Thus, it is advised to wrap the icon in an interactive element, such as `<sp-action-button>`.

## Variants

### Informative
Expand Down

0 comments on commit 0a8e022

Please sign in to comment.