Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Accessibility tips & tricks for CSS developers

Accessibility tips & tricks for CSS developers

Marco Solazzi

March 25, 2016
Tweet

More Decks by Marco Solazzi

Other Decks in Programming

Transcript

  1. “ … enabling as many people as possible to use

    Web sites, even when those people's abilities are limited in some way. ” Accessibility https://developer.mozilla.org/en-US/docs/Web/Accessibility
  2. “ … enabling as many people as possible to use

    Web sites, even when those people's abilities are limited in some way. ” Accessibility - https://developer.mozilla.org/en-US/docs/Web/Accessibility
  3. - vision impairments - limited fine motor control - cognitive

    disabilities - hearing impairments - older people (ourselves tomorrow) For whom?
  4. Because we have to. Goverments are enforcing accessibility by legislation.

    Why? - US: List of Web Accessibility-Related Litigation and Settlements (http://bit.ly/1n1JkQl) - IT: Legge Stanca (https://it.wikipedia.org/wiki/Legge_Stanca)
  5. “I’m going to do the website that way. If people

    can’t use it they can go f**k themselves!” Everyday rant... - random world class designer / developer
  6. “I’m going to put stairs here. If people can’t climb

    them they can go f**k themselves!” What if... - random world class architect
  7. 1. set html font-size to 100% 2. use rem fonts

    and em media queries 3. high-contrast optional theme Unreadable beauty
  8. 1. set html font-size to 100% 2. use rem fonts

    and em media queries 3. high-contrast optional theme Bonus: Use currentColor for flexible theming Unreadable beauty
  9. Every tag has its place in the world document. …

    even <ruby> - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby
  10. <table>s are evil! Let’s use <div>s … and display: table

    Problems: 1. not semantic 2. unannounced by screen-readers Table syndrome
  11. <button>s are ugly! Let’s use <span>s and <a>s with JS

    Problems: 1. missing focus 2. different/missing keyboard interactions Table syndrome
  12. “ … provides visual feedback for links that have "focus"

    when navigating a web document using the TAB key (or equivalent). ” Outline dilemma - http://www.outlinenone.com
  13. “ … provides visual feedback for links that have "focus"

    when navigating a web document using the TAB key (or equivalent). ” - http://www.outlinenone.com Outline dilemma
  14. If you really can’t stand outline, remove it just for

    mouse / touch interactions. Outline dilemma - https://github.com/lindsayevans/outline.js - https://www.paciellogroup.com/blog/2012/04/how-to-remove-css-outlines-in-an- accessible-manner/
  15. How many ways to hide something? 1. opacity: 0 2.

    visibility: hidden 3. display: none Out of sight
  16. How many ways to hide something? 1. opacity: 0 2.

    visibility: hidden 3. display: none ← accessibility friendly Out of sight
  17. I want more! Resources - http://a11yproject.com/ - https://www.paciellogroup.com/ - http://webaim.org/

    - http://a11yweekly.com/ People - https://twitter.com/LeonieWatson - https://twitter.com/stevefaulkner