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

Add tooltip to navList if the text is truncated #2610

Merged
merged 31 commits into from
Feb 27, 2024

Conversation

thesnowrose
Copy link
Contributor

@thesnowrose thesnowrose commented Feb 16, 2024

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

What are you trying to accomplish?

Currently for the Primer::Beta::NavList there is no way to show a tooltip only on text truncation. This PR gives the ability to choose whether or not to add a tooltip based on whether or not the text is truncated, (an ellipsis is present) in the navlist.

Screenshots

Before, the tooltip would show regardless if the text was truncated, now we can control when the show it.
The screenshot is an image of a navlist item, with text that is truncated at the end by showing an ellipsis, and a tooltip is present.

Integration

No, this does not break existing production code only a new feature to be added if wanted.

List the issues that this change affects.

Closes: https://github.com/github/actions-build/issues/200
Closes: https://github.com/github/primer/issues/2791

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Anything you want to highlight for special attention from reviewers?

Accessibility

  • Fixes axe scan violation - This change fixes an existing axe scan violation.
  • No new axe scan violation - This change does not introduce any new axe scan violations.
  • New axe violation - This change introduces a new axe scan violation. Please describe why the violation cannot be resolved below.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

Copy link

changeset-bot bot commented Feb 16, 2024

🦋 Changeset detected

Latest commit: 8e61e91

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Feb 21, 2024

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

Copy link
Contributor

Uh oh! @thesnowrose, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

1 similar comment
Copy link
Contributor

Uh oh! @thesnowrose, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@thesnowrose thesnowrose marked this pull request as ready for review February 21, 2024 19:44
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

I'd like to know what @primer/accessibility-reviewers think of this. I get the sense this would be quite confusing for ATs unless we somehow hide the tooltip for them?

previews/primer/alpha/action_list_preview.rb Outdated Show resolved Hide resolved
app/components/primer/alpha/action_list.ts Outdated Show resolved Hide resolved
@guo-chris
Copy link

guo-chris commented Feb 27, 2024

I'd like to know what @primer/accessibility-reviewers think of this. I get the sense this would be quite confusing for ATs unless we somehow hide the tooltip for them?

To provide some additional context:
We brought this to accessibility office hours, issue: https://github.com/github/accessibility/issues/5240
Recording: https://github.rewatch.com/video/4yjvv2s2to3lwle1-accessibility-team-eng-office-hours-december-13-2023?t=893
They recommended we use the Primer tooltip instead of the browser's built-in "tooltip" since it can be viewed and dismissed for keyboard navigation users. The full name is already read out for screen reader users.

I checked the preview with Chrome + NVDA, the full name is announced only once
Screenshot of Chrome showing a Primer NavList item and NVDA speech viewer showing the item's label only once

@camertron camertron merged commit 14890a3 into main Feb 27, 2024
30 checks passed
@camertron camertron deleted the nav_list_tooltips_on_truncation branch February 27, 2024 21:04
@primer primer bot mentioned this pull request Feb 27, 2024
@primer primer bot mentioned this pull request Mar 15, 2024
jonrohan pushed a commit that referenced this pull request Mar 27, 2024
Co-authored-by: Cameron Dutro <camertron@gmail.com>
Co-authored-by: thesnowrose <thesnowrose@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants