Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(Tooltip): Add label behavior for Tooltip #1635

Merged
merged 8 commits into from
Jul 16, 2019

Conversation

sophieH29
Copy link
Contributor

This PR creates tooltipAsLabelBehavior accessibility behavior, so when used, it will apply aria-labelledby attribute to trigger button in case it is needed to label visual-only elements. aria-describedby doesn't work well for JAWS

@sophieH29 sophieH29 self-assigned this Jul 15, 2019
@sophieH29 sophieH29 added accessibility All the Accessibility tasks and bugs should be tagged with this. ⚙️ enhancement New feature or request 🚀 ready for review labels Jul 15, 2019
@codecov
Copy link

codecov bot commented Jul 15, 2019

Codecov Report

Merging #1635 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1635      +/-   ##
==========================================
+ Coverage   71.23%   71.27%   +0.04%     
==========================================
  Files         851      852       +1     
  Lines        7032     7042      +10     
  Branches     2004     2027      +23     
==========================================
+ Hits         5009     5019      +10     
  Misses       2017     2017              
  Partials        6        6
Impacted Files Coverage Δ
packages/react/src/components/Tooltip/Tooltip.tsx 61.97% <ø> (ø) ⬆️
...bility/Behaviors/Tooltip/tooltipAsLabelBehavior.ts 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1bfffc...a729993. Read the comment docs.

@@ -81,6 +83,8 @@ export interface TooltipProps
/**
* A tooltip that displays information related to an element when the element receives keyboard focus
* or the mouse hovers over it.
* @accessibility
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add example for this one on the docs?

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 was thinking about it. From one side this behavior changes one attribute and it is listed in the accessibility section on cases when to use it. And at other side, it is a variance of a tooltip.
If you think better to add it, I'll do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mnajdova I added a tooltip best practices section and mentioned it there. I think should be enough for now. Let's observe, if discoverability is bad, will add a separate example in future

Co-Authored-By: Marija Najdova <[email protected]>
@codecov
Copy link

codecov bot commented Jul 15, 2019

Codecov Report

Merging #1635 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1635      +/-   ##
==========================================
+ Coverage   71.24%   71.28%   +0.04%     
==========================================
  Files         851      852       +1     
  Lines        7035     7045      +10     
  Branches     2006     2029      +23     
==========================================
+ Hits         5012     5022      +10     
  Misses       2017     2017              
  Partials        6        6
Impacted Files Coverage Δ
packages/react/src/components/Tooltip/Tooltip.tsx 61.97% <ø> (ø) ⬆️
...bility/Behaviors/Tooltip/tooltipAsLabelBehavior.ts 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48de2f2...d9e8c8b. Read the comment docs.

@vercel vercel bot requested a deployment to staging July 16, 2019 10:47 Abandoned
@vercel vercel bot requested a deployment to staging July 16, 2019 11:08 Abandoned
@vercel vercel bot requested a deployment to staging July 16, 2019 11:55 Abandoned
import ComponentBestPractices from 'docs/src/components/ComponentBestPractices'

const doList = [
'Use `tooltipAsLabelBehavior` if adding tooltip to icon-only button or to another visual-only element without any text, title or label.',
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@sophieH29 sophieH29 merged commit 50e11d1 into master Jul 16, 2019
@delete-merged-branch delete-merged-branch bot deleted the feat/tooltip-label-behavior branch July 16, 2019 12:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accessibility All the Accessibility tasks and bugs should be tagged with this. ⚙️ enhancement New feature or request 🚀 ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants