question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce button tooltips to help clarify icons

See original GitHub issue

In much of Google UI, buttons (particularly icon buttons) have tooltips with a (secondary) text label. While for regular buttons, this is not as critical, for icon buttons this is quite helpful as it helps convey the meaning of each icon. For screen readers, we already have assistive text, but that text is not accessible for e.g. browser users.

Here is a screenshot from Google Drive as example: Screen Shot 2021-05-26 at 1 55 59 PM (originally posted in https://github.com/google/site-kit-wp/issues/3379#issuecomment-849039705)

Site Kit should support tooltips with similar appearance for its icon buttons. This is somewhat related to the user feedback epic since a few of those icon buttons are present there.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Site Kit’s Button component should be enhanced so that, if it displays an icon (via icon prop) and a text label is also present (e.g. via aria-label prop), that text label displays as a small tooltip with white text on gray background, following the overall design present in the screenshot above.
  • The following aria-label props related to the above enhancement should be changed to be more concise:
    • In HelpMenu, the help icon’s aria-label should say just “Help” - it does not need the full actions since it appears in a list of menu items and controls where this is unnecessary.
    • In SurveyHeader, the dismiss icon’s aria-label should say just “Dismiss” - the user is in the survey and its title comes just before in the DOM order, so it’s unnecessary to state that they’re dismissing the survey.
    • In SurveyQuestionRatingChoice, the choice icon’s aria-label should just say choice.text - the “icon” suffix is rather useless since for screen reader users it is irrelevant that the choice is an icon, while visually it’s obvious that it is an icon anyway (it’s a label rather than an alt description).

Implementation Brief

  • Install the @material-ui/core package.
  • Update the Button component,
    • Add the aria-label prop as it is done in the Link component.
    • Wrap the markup for the component within the Tooltip component (imported from the @material-ui/core package) with the title prop set to the aria-label value if there is an icon and aria-label and no children.
    • When wrapping around the Tooltip component, add an extra span tag around the markup or else the tooltip is not positioned correctly.
  • Update the aria-label used in the HelpMenu, SurveyHeader and SurveyQuestionRatingChoice as per the AC.

Test Coverage

  • No new tests to be added.

Visual Regression Changes

  • There should be no visual changes.

QA Brief

  • Run storybook locally via the npm run storybook command.
  • Upon hovering the icons in the “Surveys -> Current Survey -> Single Question” story, a tooltip should appear with the label of the icon and “Dismiss” for the close icon.
  • Do the same for the “Plugin Header with Help menu” story. A tooltip saying “Help” should appear upon hovering the help icon.

Changelog entry

  • Improve button tooltips across plugin.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
asvinbcommented, Jun 24, 2021

Thanks @wpdarren . A follow up PR has been created.

0reactions
wpdarrencommented, Jun 29, 2021

QA Update: Pass ✅

  • Verified that tooltips appear on Storyboard.
  • Verified that tooltips appear on local site for all rating icons and dismiss icon. Screenshot
  • Verified that tooltips appear on local site for help icon. Screenshot
  • Tested this on primary browsers, i.e. Firefox, etc.

Thanks @asvinb @aaemnnosttv 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip Guidelines - Nielsen Norman Group
Tooltips can be attached to any active element (icons, text links, buttons, etc.) on a page. They provide descriptions or explanations for ...
Read more >
Use Tooltips To Clarify Functions | Framework | Vaadin 8 Docs
Use tooltips to clarify functions. Even when clearly labelled, the action performed by a button might not be clear enough to the user....
Read more >
Tooltips and Infotips - Win32 apps | Microsoft Learn
Use infotips to describe or explain objects and controls such as toolbar controls, icons (including icon overlays), links, tabs, progressive ...
Read more >
Designing Better Tooltips For Mobile User Interfaces
In this article, we show you how to design tooltips that will amplify your mobile designs and explain where mobile tooltips are most...
Read more >
Tooltips: How to create and use the mighty UI pattern - Appcues
Tooltips are UI patterns that offer a way to guide a customer through their user journey with minimal friction. Well-designed tooltips gently educate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found