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

Update Tooltip visual design in interface guidelines + accessibility guidelines #565

Merged
merged 19 commits into from
Oct 9, 2023

Conversation

langermank
Copy link
Contributor

@langermank langermank commented Aug 24, 2023

tooltip anatomy graphic

Goals

  • Update the visual design of the Tooltip component (remove caret)
  • Surface the tooltip alternatives into the main interface guidelines to improve discoverability
  • Add a few more usage guidelines and explain label vs. description

Accessibility page → https://primer-14e523666e-26441320.drafts.github.io/guides/accessibility/tooltip-alternatives
Interface guidelines → https://primer-14e523666e-26441320.drafts.github.io/components/tooltip

TODO

@langermank langermank temporarily deployed to github-pages August 24, 2023 01:01 — with GitHub Actions Inactive
@langermank langermank marked this pull request as ready for review August 24, 2023 01:13
@langermank langermank requested a review from a team as a code owner August 24, 2023 01:13
@langermank langermank marked this pull request as draft August 24, 2023 01:14
@langermank langermank temporarily deployed to github-pages August 24, 2023 01:20 — with GitHub Actions Inactive
@langermank langermank temporarily deployed to github-pages August 24, 2023 21:39 — with GitHub Actions Inactive
@langermank langermank temporarily deployed to github-pages August 24, 2023 21:55 — with GitHub Actions Inactive
@langermank langermank temporarily deployed to github-pages August 24, 2023 22:04 — with GitHub Actions Inactive
@langermank langermank marked this pull request as ready for review August 24, 2023 22:07
@langermank langermank requested a review from khiga8 August 24, 2023 22:07
alt="tooltips rendered in all possible positions surrounding a control"
/>

## Alternatives to tooltips
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this section so much

content/components/tooltip.mdx Outdated Show resolved Hide resolved
content/components/tooltip.mdx Show resolved Hide resolved
Copy link
Contributor

@khiga8 khiga8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass! Thank you for working on this :)
I hope to take a closer look tomorrow!

alt="tooltips rendered in all possible positions surrounding a control"
/>

## Alternatives to tooltips
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a couple of lint rules and doc pages where we cross-reference the existing Tooltip alternatives docs. Let's make sure to update those to avoid a dead link! (I can verify tomorrow which ones those are).

Or could it be sufficient to just cross-reference that page from this section rather than moving it entirely?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow up with the links outside this repo once this PR merges! ❤️ thank you


Most UI cases don't call for tooltips. Learn some [alternative methods to use in place of tooltips](/../guides/accessibility/tooltip-alternatives).
## Additional resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We introduced a new PVC lint rule recently the deprecated Primer CSS tooltipped which we have a ton of debt around that we want to tackle. It looks like the lint rule doc is now on Primer CSS Tooltipped.
Could it make sense to link to it here? :)


## Options

### Label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be useful to talk about the underlying markup of the differences between a label and description (e.g. aria-labelledby vs aria-describedby)? One will serve as the accessible name of a control, while the other will supplement it.

We have some more documentation in Primer Rails tooltip (This was originally under an accessibility section in Primer Rails but I think it changed with the recent docs site update!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you! I had a hard time trying to explain this one so let me see if I can rework it a bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is shipped in React. Would we want to hold off on this section to avoid confusing people 🤔

(cc: @broccolinisoup who worked on React tooltip :) )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you! I had a hard time trying to explain this one so let me see if I can rework it a bit.

Katie let me know if you want to pair on this or any help with it!

I don't think this is shipped in React. Would we want to hold off on this section to avoid confusing people

Yes! We are going to ship the draft version soon hopefully 🙏🏻 and also the visual changes (i.e. removing the caret) also will be shipped with the draft version so holding off merging this PR until the draft is out would be wise.

Copy link
Contributor

@lukasoppermann lukasoppermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@lukasoppermann
Copy link
Contributor

Hey @langermank could you add a Figma section as well?

content/components/tooltip.mdx Outdated Show resolved Hide resolved
content/components/tooltip.mdx Outdated Show resolved Hide resolved
content/components/tooltip.mdx Outdated Show resolved Hide resolved
content/components/tooltip.mdx Outdated Show resolved Hide resolved
content/components/tooltip.mdx Outdated Show resolved Hide resolved
alt="tooltips rendered in all possible positions surrounding a control"
/>

## Alternatives to tooltips
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Options

### Label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is shipped in React. Would we want to hold off on this section to avoid confusing people 🤔

(cc: @broccolinisoup who worked on React tooltip :) )

content/components/tooltip.mdx Outdated Show resolved Hide resolved
Comment on lines 117 to 118
For interactive controls that require additional context, a tooltip can be used to provide it. The `label` is also
required, and the description will be announced to a screen reader in addition to the label. Keep the description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will want to reword this a bit since this seems to suggest one should set both the label and description prop of the tooltip API which I don't think is the case. Maybe we want to say that when a tooltip supplements a control as a description, we should make sure the control has an accessible name?

<button aria-describedby="tooltip-1">Name of button</button>
<tooltip id="tooltip-1">Some supplementary description</tooltip>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make sure the control has an accessible name?

I agree with this. Since accessible name could be a visible button text or an aria-label, we can maybe divide the "Description" section into two subsections?

Description for buttons that has a visible name

<button aria-describedby="tooltip-1">Name of button</button>
<tooltip id="tooltip-1">Some supplementary description</tooltip>

Description for buttons that doesn't have a visible name

<iconbutton aria-label="icon-button-label" />
<tooltip id="tooltip-1">Some supplementary description</tooltip>


## Options

### Label
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we mention how a label type tooltip should be reserved for icon buttons? The underlying semantic of a label tooltip is aria-labelledby would override any label the button already has.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is clear already by saying "For interactive controls with no visible text label" but I will add "such as icon buttons" 😄

@broccolinisoup broccolinisoup self-requested a review August 28, 2023 01:17
Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool 🔥 Left some comments, let me know what you think 🙌🏻

content/components/tooltip.mdx Outdated Show resolved Hide resolved

## Options

### Label
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you! I had a hard time trying to explain this one so let me see if I can rework it a bit.

Katie let me know if you want to pair on this or any help with it!

I don't think this is shipped in React. Would we want to hold off on this section to avoid confusing people

Yes! We are going to ship the draft version soon hopefully 🙏🏻 and also the visual changes (i.e. removing the caret) also will be shipped with the draft version so holding off merging this PR until the draft is out would be wise.

Comment on lines 117 to 118
For interactive controls that require additional context, a tooltip can be used to provide it. The `label` is also
required, and the description will be announced to a screen reader in addition to the label. Keep the description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make sure the control has an accessible name?

I agree with this. Since accessible name could be a visible button text or an aria-label, we can maybe divide the "Description" section into two subsections?

Description for buttons that has a visible name

<button aria-describedby="tooltip-1">Name of button</button>
<tooltip id="tooltip-1">Some supplementary description</tooltip>

Description for buttons that doesn't have a visible name

<iconbutton aria-label="icon-button-label" />
<tooltip id="tooltip-1">Some supplementary description</tooltip>

langermank and others added 6 commits September 15, 2023 11:29
Co-authored-by: Kate Higa <16447748+khiga8@users.noreply.github.com>
Co-authored-by: Kate Higa <16447748+khiga8@users.noreply.github.com>
Co-authored-by: Kate Higa <16447748+khiga8@users.noreply.github.com>
Co-authored-by: Kate Higa <16447748+khiga8@users.noreply.github.com>
@langermank langermank temporarily deployed to github-pages October 6, 2023 18:56 — with GitHub Actions Inactive
@langermank langermank merged commit b9ad2cf into main Oct 9, 2023
4 checks passed
@langermank langermank deleted the update-tooltip-docs branch October 9, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants