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

Improve accessibility for screen readers #3851

Merged
merged 7 commits into from
Apr 2, 2019

Conversation

Neurrone
Copy link
Contributor

@Neurrone Neurrone commented Mar 31, 2019

Fixes #3850

  • Use aria-label to label iconic buttons in the reporter
  • Use CSS to provide text for screen readers in the statistics list

Investigated fixing the runnables and collapsable components so they would announce whether they are collapsed/expanded and to make them keyboard navigable, but because the collapsable content is a child of the node that can be clicked to toggle them would cause even worse side effects. For instance, the DOM looks something like this

<div onClick="toggle collapsable open">
  <div>
    children
  </div>
</div>

Adding expanded indicators to the parent div would cause expanded to be announced not just for the title, but also all children, which is even worse than the current situation.

The DOM would need to be changed to something like

<div>
  <div onClick="toggle collapsable open"></div>
  <div>
    children
  </div>
</div>

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2019

CLA assistant check
All committers have signed the CLA.

@jennifer-shehane jennifer-shehane self-requested a review April 1, 2019 10:45
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these changes! I manually ran, looks good so far.

Feel free to make the DOM updates needed for the 'expand' / 'collapse' notification.

It would be nice to have some tests around this. We don't have any accessibility tests atm.

@jennifer-shehane jennifer-shehane changed the title Improve accessibility for screen readers [WIP] Improve accessibility for screen readers Apr 1, 2019
@Neurrone
Copy link
Contributor Author

Neurrone commented Apr 1, 2019

@jennifer-shehane done. Would appreciate if you can verify that no unintended changes were introduced to how it looks visually. You should be able to test the keyboard operability by using the tab keys, and using space/enter to expand/collapse.

I figured out a way to make it work with only a change in the DOM structure for Collapsable by introducing an extra <div>, but was able to attach the keyboard listeners and set the attributes needed in the title's <span> in Test.

The more ideal solution would be to use the more semantic <button> element and CSS to style it if starting from scratch.

I happen to be investigating the use of react-axe and eslint-plugin-jsx-a11y for work.

The thing that really helps most is end-user testing, since automated checks could find the lack of programatic labels, but wouldn't be able to tell you that there are no corresponding indicators for info that is only presented visually.

I'll be happy to answer any questions :)

@Neurrone Neurrone changed the title [WIP] Improve accessibility for screen readers Improve accessibility for screen readers Apr 1, 2019
@Neurrone Neurrone marked this pull request as ready for review April 1, 2019 16:29
@jennifer-shehane jennifer-shehane self-requested a review April 2, 2019 04:23
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just going to manually test this, but then I thought -- hey, I cant test this 'enter' and 'space' functionality in Cypress! 😄

Running Cypress tests for the reporter code is still a bit new for us, so I wanted to play with it - but, in the future if you want to write tests for changes to the reporter, you can do so by following the conventions set up in our existing tests found in packages/reporter/cypress/integration. I also added instructions on how to run it to the packages/reporter/README.md

@jennifer-shehane jennifer-shehane merged commit df01397 into cypress-io:develop Apr 2, 2019
@Neurrone
Copy link
Contributor Author

Neurrone commented Apr 2, 2019

Thanks @jennifer-shehane

@Neurrone Neurrone deleted the issue-3850 branch April 2, 2019 13:35
@Neurrone
Copy link
Contributor Author

Neurrone commented Apr 4, 2019

Not sure what the process is - would also be happy to help with the changelog entry.

@jennifer-shehane
Copy link
Member

This is good and ready to go in 3.3.0. New docs + changelog can be found here: cypress-io/cypress-documentation#1534

We are still fixing up some issues found in the release unrelated to this PR.

@desfero
Copy link
Contributor

desfero commented Apr 8, 2019

@Neurrone will this also fix this one reported by me #3741?

@Neurrone
Copy link
Contributor Author

Neurrone commented Apr 8, 2019

@desfero if you're referring to the expandable nodes in the reporter, then yes. You should be able to tab to it and hit either enter or space to toggle collapsing / expanding.

@jennifer-shehane
Copy link
Member

@Neurrone This PR actually only targets accessibility in the Test Runner screen. This one:

Reporter

This does not address your issue, which is about accessibility within the packages/desktop-gui: #3741

@jennifer-shehane
Copy link
Member

Also - another issue related to keyboard support in the packages/reporter is here: #248

laurinenas pushed a commit to laurinenas/cypress that referenced this pull request Apr 28, 2019
* reporter: add accessible labels for header controls

* Add labels for the refresh runs list and selector playground buttons

* Make the Collapsable and Test components screen reader accessible and keyboard operable, move the visually-hidden style to the root stylesheets

* Correct import

* Write tests for expand/collapse of tests + suites

* Add instructions on how to run reporter tests in Cypress


Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
@cypress-io cypress-io locked as resolved and limited conversation to collaborators Apr 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen reader accessibility
4 participants