hmrc / accessibility-testing-library

Apache License 2.0
4 stars 2 forks source link

False positive Bad value “text” for attribute “role” on element “p”. #11

Open spattisson opened 5 years ago

spattisson commented 5 years ago

The following paragraph contains bold text which is purely decorative. The role text is therefore used on the paragraph to prevent a screen reader from changing the speech tone.

You are £325,234.33 in credit and have no tax to pay.

The problem is that the audit is taking issue with this: <p role="text">You are <span class="amount">£325,234.33</span> in credit and have no tax to pay.</p> stating

Bad value “text” for attribute “role” on element “p”.

chrisjameswright commented 5 years ago

Thanks for raising the issue and giving a relevant example.

From a quick Google search it appears this is because role="text" didn't make it into the most recent aria spec, so the underlying library is quite rightly highlighting this as an inappropriate role.

For our purposes, I can see why this is a false positive in the general case, but would appreciate some input from someone who is better informed about this specific case prior to adding it to the filters used by default for all projects.

In the meantime, you should be able to look at the https://github.com/hmrc/accessibility-testing-library/blob/master/README.md#auditfilters section of the readme to get an idea of how to implement this in your own suite.

Does that sound reasonable?

spattisson commented 5 years ago

Sure, thanks Chris. I'll apply a custom filter.