Hiding content

A presentation at Fronteers Jam Session in October 2017 in Amsterdam, Netherlands by Hidde de Vries

Slide 1

Slide 1

Hiding
content Hidde de Vries / @hdv / Fronteers Jam Session, Amsterdam / 05-10-2017

Slide 2

Slide 2

My name is Hidde

Slide 3

Slide 3

My name is Hidde

Slide 4

Slide 4

Hiding
content

Slide 5

Slide 5

This is actually an accessibility talk

Slide 6

Slide 6

Tactile paving

Slide 7

Slide 7

Elevator

Slide 8

Slide 8

Colour

Slide 9

Slide 9

Language

Slide 10

Slide 10

Code

Slide 11

Slide 11

When you send your
markup to the browser, it generates two trees (amongst others)

Slide 12

Slide 12

DOM tree

Slide 13

Slide 13

Accessibility tree

Slide 14

Slide 14

Roles role = alert role = link role = button role = checkbox role = tab role = radio role = dialog role = progressbar role = slider role = tooltip

Slide 15

Slide 15

States hidden open expanded checked pressed selected hidden open expanded checked

Slide 16

Slide 16

Labels “skip to content” “open menu” “first name” “table of contents” “about us” “show more” “click here” “go to next photo” “skip to content” “open menu”

Slide 17

Slide 17

People use AT, assistive technologies. Examples: braille terminals, screenreaders speech input software, alternate input devices

Slide 18

Slide 18

Accessibility tree Platform APIs AT Microsoft Active Accessibility Microsoft User Interface Automation

MSAA

Mac OS X Accessibility Protocol

Linux/Unix Accessibility Toolkit

IAccessible2 braille text-to-speech screen magnifiers alternate pointing devices

Slide 19

Slide 19

Accessibility tree Platform APIs AT Microsoft Active Accessibility Microsoft User Interface Automation

MSAA

Mac OS X Accessibility Protocol

Linux/Unix Accessibility Toolkit

IAccessible2 Yo u r markup DOM tree

Slide 20

Slide 20

Hiding
content

Slide 21

Slide 21

Hiding from screen “visually hidden”

Slide 22

Slide 22

Icon button EXAMPLE Please accept our cookie policy OK ×

Slide 23

Slide 23

Required indicator EXAMPLE First name *

Slide 24

Slide 24

position: absolute; left: -9999em;

Slide 25

Slide 25

Slide 26

Slide 26

Hiding from AT

Slide 27

Slide 27

A decorative icon EXAMPLE ! Cars

Slide 28

Slide 28

Repeating text that hinders AT users EXAMPLE Our company won a prize We are very proud to announce that we were nominated for an amazing price and that we have actually won it, too. Read more We opened a new office With the great opening party that took place yesterday, it is now official: our
new office in Utrecht is open! Read more We’ll be at the trade show The trade show is taking place next week and we will be presenting interesting new stuff. Visit our booth! Read more

Slide 29

Slide 29

Repeating text that hinders AT users EXAMPLE Our company won a prize We are very proud to announce that we were nominated for an amazing price and that we have actually won it, too. Read more We opened a new office With the great opening party that took place yesterday, it is now official: our
new office in Utrecht is open! Read more We’ll be at the trade show The trade show is taking place next week and we will be presenting interesting new stuff. Visit our booth! Read more Read more Read more Read more

Slide 30

Slide 30

aria-hidden

Slide 31

Slide 31

<div aria-hidden></div>

Slide 32

Slide 32

If you find you have to use aria-hidden , this may indicate there’s something wrong with the page

Slide 33

Slide 33

Repeating text that hinders AT users EXAMPLE Our company won a prize We are very proud to announce that we were nominated for an amazing price and that we have actually won it, too. Read more We opened a new office With the great opening party that took place yesterday, it is now official: our
new office in Utrecht is open! Read more We’ll be at the trade show The trade show is taking place next week and we will be presenting interesting new stuff. Visit our booth! Read more

Slide 34

Slide 34

Slide 35

Slide 35

Hiding from everything

Slide 36

Slide 36

A modal panel that is not currently shown EXAMPLE Perhaps the most heavily-repeated pattern in JavaScript-based page manipulation is showing and hiding content. Tabbed interfaces. Collapsible elements. Accordion widgets. It crops up nearly everywhere. In and of itself, this pattern is not a bad thing, but few people realize how profoundly your choice of hiding mechanism can influence the accessibility of your content to assistive technologies like screen readers. When building custom JavaScript-based widgets, it’s quite easy to fully control the hiding mechanism, but when you begin working with animation libraries like jQuery or Scriptaculous, the hiding mechanism is typically dictated by the library, leaving you little control over the accessibility of your Are you sure? NO YES

Slide 37

Slide 37

A tab control that 
 is closed EXAMPLE

  1. Personal details 
 
 
 
 

  2. Your application
  3. Agreement
  4. Summary △

Slide 38

Slide 38

display: none;

Slide 39

Slide 39

hidden

Slide 40

Slide 40

<div hidden></div>

Slide 41

Slide 41

Slide 42

Slide 42

Not exposed by a11y tree Not rendered Invisible to text search

Slide 43

Slide 43

Slide 44

Slide 44

Inert

Slide 45

Slide 45

inert https://github.com/WICG/inert https://html.spec.whatwg.org/multipage/interaction.html#inert

Slide 46

Slide 46

Makes the element and its entire subtree inert :
visible, but unusable

Slide 47

Slide 47

No pointer events. No focus. Invisible to text search. Impossible to select.

Slide 48

Slide 48

Rest of the page while modal is open (“<dialog> without <dialog>” – Hixie ) EXAMPLE Perhaps the most heavily-repeated pattern in JavaScript-based page manipulation is showing and hiding content. Tabbed interfaces. Collapsible elements. Accordion widgets. It crops up nearly everywhere. In and of itself, this pattern is not a bad thing, but few people realize how profoundly your choice of hiding mechanism can influence the accessibility of your content to assistive technologies like screen readers. When building custom JavaScript-based widgets, it’s quite easy to fully control the hiding mechanism, but when you begin working with animation libraries like jQuery or Scriptaculous, the hiding mechanism is typically dictated by the library, leaving you little control over the accessibility of your Are you sure? NO YES

Slide 49

Slide 49

Non current
carousel items EXAMPLE Now playing ➜ ➜

Slide 50

Slide 50

‘Shipping address’ section when ‘Same as billing address’ is checked EXAMPLE Billing address Shipping address ✔ Same as billing address Street
* Postal code
* City
*

Street *

Postal code *

City *

Slide 51

Slide 51

Hiding content From screen From AT From everything Inert Accessible to:
✔ AT users

✗ sighted users Accessible to:
✗ AT users

✔ sighted users Accessible to:
✗ AT users

✗ sighted users Visible, but not usable

  • Note that there are a lot of different ATs, and they are not all for users with sight impairments

Slide 52

Slide 52

Further reading http://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html

https://github.com/alice/inert

https://allyjs.io/tutorials/hiding-elements.html

https://hiddedevries.nl/en/blog/2017-04-11-on-hiding-content

https://www.w3.org/TR/html-aam-1.0/

Slide 53

Slide 53

Thanks for listening.


 Tweet/email any questions/comments! @hdv / hidde@hiddedevries.nl

Slide 54

Slide 54