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

Accessible hiding CSS class is deviates from recommended approach #1042

Closed
mathalete opened this issue Apr 27, 2021 · 3 comments
Closed

Accessible hiding CSS class is deviates from recommended approach #1042

mathalete opened this issue Apr 27, 2021 · 3 comments
Labels
accessibility question Further information is requested

Comments

@mathalete
Copy link

mathalete commented Apr 27, 2021

The accessible hiding in Canvas Kit deviates from the industry accepted best practice class. https://github.com/Workday/canvas-kit/blob/master/modules/react/common/lib/styles/accessibleHide.ts

The Canvas Kit class includes 3 additional declarations.

margin: '-1px', padding: 0, border: 0,

I've not tested this augmentation with right to left languages, or across a range of screen reader / browsers, so was interested in why the additional declarations are included.

If this hasn't been robustly tested it is recommended to instead use the well researched original class as detailed here (https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/)

`.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}`

Thanks

@mathalete mathalete added the bug Something isn't working label Apr 27, 2021
@jpante
Copy link
Member

jpante commented Jun 14, 2021

@mathalete Is this something the team can validate if it's an issue? I'll leave this as open for now.

@jpante jpante added the question Further information is requested label Jun 14, 2021
@vibdev
Copy link
Contributor

vibdev commented Jul 16, 2021

padding and border 0 are needed otherwise <div style="{padding: 10px, border: 5px solid}"> is going to have a layout width of 31px instead of 1px. Same with margin you will want to null that out. Setting to -1px vs 0px I think is debatable and in fact here is a really long one:

h5bp/main.css#12

@jaclynjessup jaclynjessup moved this to 🧊 Ice Box in Canvas Kit Aug 8, 2022
Repository owner moved this from 🧊 Ice Box to ✅ Done in Canvas Kit Sep 15, 2022
@alanbsmith
Copy link
Member

Closing this. Rusty's answer makes sense. 👍🏻 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility question Further information is requested
Projects
Status: ✅ Done
Development

No branches or pull requests

5 participants