smclab / react-faceted-token-input

A React component which is a tokenized input with faceted behavior
http://smclab.github.io/react-faceted-token-input/
GNU Lesser General Public License v2.1
9 stars 2 forks source link

Test for a11y #11

Open yuchi opened 8 years ago

yuchi commented 8 years ago

(a11y means ‘Accessibility’)

GianBe commented 8 years ago

Just to keep some notes on what I'm considering:

These are packages that will be available in the JSON file of the project and can be used by other developers.

I did install the chrome accessibility developer tools for local testing and I'm considering the installation of a screen reader like ChromeVox

yuchi commented 8 years ago

Having automated tests for a11y would be awesome.

Please, make a list of devices and screen readers you intend to test on.

GianBe commented 8 years ago

Right now I'm trying to make it work on my pc using chrome and the ChromeVox extension (as my screen reader) and as a mobile device I borrowed an iphone, but I have some trouble with the dropdowns.

I notice that different screen-readers behave a little differently from one another for example the ChromeVox extension reads the token as a whole while the iphone reads one element of the token at a time (I think that is a problem with the chrome extension but I don't have the information I need to be sure).

I'm trying to use react-a11y and I have to say that it gives useful advice I think at some point it could be added to the project JSON.

yuchi commented 8 years ago

Nest steps:

GianBe commented 8 years ago

Traget platforms and tools:

GianBe commented 8 years ago

I'm sorry I didn't update you on the status of the work, in this branch you will find my attempt to add accessibility. A little recap of the work:

GianBe commented 8 years ago

Just tested with JAWS.

I found something strange, Firefox + JAWS works as intended while Chrome + JAWS doesn't properly work.

Edit: Chrome is not fully supported by JAWS, the component in Firefox works with JAWS

GianBe commented 8 years ago

A little update on an experimental accessibility support for addition and deletion of token: The idea was to add an hidden div element with the attribute aria-live="true" that adds a p element with the added token information inside to report the change, but I have a problem none of the screen readers that I have read the change.

In my code I tried adding in the render method of FacetedTokenInput:

...

  { /* the following div needs to be hidden if this code is going into the master branch */ }
  <div id="a11ysupport" aria-live="polite" aria-relevant="additions" aria-atomic="true">

    { /* simply add all the tokens that exist in the input */ }
    { tokens.map(this.a11ySupport, this) }

  </div>

...

and I added this method:

// this should add a node that should be detected by aria-live="true"
  a11ySupport(token, index) {
    const { facet, description } = this.props.renderToken(token);

    return (
      <p key={ "test" + index }>
        { facet }
        { ' ' }
        { description }
        { ' ' }
      </p>
    )
  }

Since I was trying to mimic the behaviour of gmail I looked at its code and google uses a similar method in fact when you add a contact to your email and create a "token" this div gets updated with some text:

NOTE: the text inside the div is in italian

<div aria-live="polite" aria-atomic="true" style="position: absolute; top: -1000px; height: 1px; overflow: hidden;"> 

{ here they add what is written before the @ or the name in your contact list } aggiunto. 
Premi backspace per rimuovere il destinatario.

</div>
GianBe commented 8 years ago

Some useful documentation on the argument:

General WAI-ARIA stuff:

-periodic table of aria roles: this is a comprehensive list of all the possible aria 1.0 roles

Examples can be found here.

aria-live in particular:

Examples of live regions:

In the set there isn't an example of the alert role, this particular role has an implicit aria-live="assertive" built in.

yuchi commented 8 years ago

Do we have a compatibility table for aria-live?

GianBe commented 8 years ago

Browser compatibility:

Screen readers compatibility:

GianBe commented 7 years ago

Reopen for test