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

docs: update tooltip content from a11y review #3655

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Binary file not shown.
Binary file not shown.
Binary file modified src/pages/components/tooltip/images/tooltip-style-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-style-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-3-do.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-3-dont.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-4-do.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-4-dont.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/tooltip/images/tooltip-usage-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
73 changes: 48 additions & 25 deletions src/pages/components/tooltip/style.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@ description:
tabs: ['Usage', 'Style', 'Code', 'Accessibility']
---

<PageDescription>

The following page documents visual specifications such as color, typography,
structure, and size.

</PageDescription>

<AnchorLinks>

<AnchorLink>Color</AnchorLink>
<AnchorLink>Typography</AnchorLink>
<AnchorLink>Structure</AnchorLink>
<AnchorLink>Feedback</AnchorLink>

</AnchorLinks>

## Color

### Standard tooltip
### Standard tooltip color

| Element | Property | Color token |
| -------------- | ---------------- | --------------------- |
| Label | text color | `$text-secondary` |
| Label | text-color | `$text-secondary` |
| Trigger button | svg | `$icon-secondary` |
| Container | background-color | `$background-inverse` |
| Text | color | `$text-inverse` |
| Text | text-color | `$text-inverse` |

#### Interactive states
#### Standard tooltip interactive states

<br />

Expand All @@ -31,7 +47,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']
<Row>
<Column colLg={8}>

![Closed and open states for a standard tooltip](images/tooltip-style-1.png)
![Closed and open states for an icon button tooltip](images/tooltip-style-1.png)

</Column>
</Row>
Expand All @@ -41,17 +57,18 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']
standard tooltip
</Caption>

### Icon button tooltip
### Icon button tooltip color

| Element | Property | Color token |
| --------- | ---------------- | --------------------- |
| Container | background-color | `$background-inverse` |
| Text | color | `$text-inverse` |
| Text | text-color | `$text-inverse` |

#### Interactive states
#### Icon button tooltip interactive states

Icon button tooltip states rely on what kind of button is being used. Refer to
button styles for specific hover and focus states.
[button styles](https://carbondesignsystem.com/components/button/style) for
specific hover and focus states.

<Row>
<Column colLg={8}>
Expand All @@ -66,16 +83,16 @@ button styles for specific hover and focus states.
button tooltip
</Caption>

### Definition tooltip
### Definition tooltip color

| Element | Property | Color token |
| --------- | ---------------- | --------------------- |
| Label | text color | `$text-secondary` |
| Label | text-color | `$text-secondary` |
| Trigger | border | `$border-strong` |
| Container | background-color | `$background-inverse` |
| Text | color | `$text-inverse` |
| Text | text-color | `$text-inverse` |

#### Interactive states
#### Definition tooltip interactive states

<br />

Expand All @@ -95,14 +112,14 @@ button styles for specific hover and focus states.

<Caption>
Example of closed (top-left), hover (top-right), active (bottom-left) and
focus (bottom-right) states for definition button tooltip
focus (bottom-right) states for definition tooltip
</Caption>

## Typography

Tooltip labels and text should be set in sentence case.

| Element | Font-size (px/rem) | Font-weight | Type token |
| Element | Font size (px/rem) | Font weight | Type token |
| --------- | ------------------ | ------------- | ----------- |
| Label | 12 / 0.75 | Regular / 400 | `$label-01` |
| Body text | 14 / 0.875 | Regular / 400 | `$body-01` |
Expand All @@ -112,9 +129,9 @@ Tooltip labels and text should be set in sentence case.
All tooltip types have a varying height based on the amount of content they
contain.

### Standard tooltip
### Standard tooltip structure

| Element | Property | px / rem | Spacing token |
| Class | Property | px / rem | Spacing token |
| ------------ | ------------- | -------- | ------------- |
| Container | max-width | 288 / 18 | – |
| | padding | 16 / 1 | `$spacing-05` |
Expand All @@ -132,7 +149,7 @@ contain.
Structure and spacing measurements for a standard tooltip | px / rem
</Caption>

### Icon button tooltip
### Icon button tooltip structure

| Class | Property | px / rem | Spacing token |
| --------- | --------------------------- | --------- | ------------- |
Expand All @@ -151,7 +168,7 @@ contain.
Structure and spacing measurements for an icon button tooltip | px / rem
</Caption>

### Definition tooltip
### Definition tooltip structure

| Element | Property | px / rem | Spacing token |
| --------- | --------------------------- | -------- | ------------- |
Expand All @@ -163,20 +180,20 @@ contain.

<div className="image--fixed">

![Structure and spacing measurements for definition tooltip](images/tooltip-style-6.png)
![Structure and spacing measurements for a definition tooltip](images/tooltip-style-6.png)

</div>

<Caption>
Structure and spacing measurements for definition tooltip | px / rem
Structure and spacing measurements for a definition tooltip | px / rem
</Caption>

### Placement
### Default placement

Tooltip directions by default are set to auto. Upon opening, tooltips can detect
the edges of the browser to properly be placed in view so the container does not
Tooltip directions, by default, are set to auto. Upon opening, tooltips can
detect the edges of the browser to be placed in view so the container does not
get cutoff. Tooltips can instead use specific directions and may be
positioned **top**, **right**, **bottom**, or **left** to the trigger item.
positioned **top**, **right**, **bottom**, or **left** of the trigger item.
Tooltips should be placed at least 16px / 1rem off of the bottom of the page and
not bleed off page or behind other content. On mobile, tooltips can only appear
below the tooltip icon.
Expand All @@ -188,3 +205,9 @@ below the tooltip icon.
</div>

<Caption>Placement examples for a tooltip</Caption>

## Feedback

Help us improve this component by providing feedback, asking questions, and
leaving any other comments on
[GitHub](https://github.com/carbon-design-system/carbon-website/issues/new?assignees=&labels=feedback&template=feedback.md).
Loading
Loading