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

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations #6910

Merged

Conversation

dtaylor113
Copy link
Contributor

@dtaylor113 dtaylor113 commented Oct 12, 2020

Root cause was the <div id="modal-container">...</div> was getting a aria-hidden=true attribute which hide it and it's children (modal header, footer, body) from accesibility tools. A11y violation due to form fields within modal could have focus, but they were hidden.

Changed element passed to react-modal's setAppElement(...) to be 'app-container' instead of 'modal-container'. setAppElement(...) will set aria-hidden=true for the element (and all it's children!) and 'hide' them from accesibility tools. This is done in order to 'hide' app elements behind the open modal, and will toggle/remove aria-hidden once the modal is closed. So previously setting AppElement to the modal was hiding the modal and it's contents from accesiblity tools! This fix requires app-container and modal-container to be sibling elements, and not child-parent.

This fix allowed the modal contents to be included in accesibility tools and thus, once fixed, raised another violation:

Running:  crud/namespace-crud.spec.ts
  Namespace
  ...
1 accessibility violation was detected for Delete Namespace modal
┌─────────┬─────────┬────────────┬──────────────────────────────────────────┬───────┐
│ (index) │   id    │   impact   │               description                │ nodes │
├─────────┼─────────┼────────────┼──────────────────────────────────────────┼───────┤
│    0    │ 'label' │ 'critical' │ 'Ensures every form element has a label' │   1   │
└─────────┴─────────┴────────────┴──────────────────────────────────────────┴───────┘

This required adding aria-label to a form element.

This PR will also cause the CI to fail upon detection of a11y violations!!

Running test-cypress.sh reported no a11y violoations, so going forward, any violations will need to be fixed prior to PR merge.

CC @jessiehuff

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Oct 12, 2020
@openshift-ci-robot openshift-ci-robot added the component/core Related to console core functionality label Oct 12, 2020
@openshift-ci-robot
Copy link
Contributor

@dtaylor113: This pull request references Bugzilla bug 1885702, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift openshift deleted a comment from openshift-ci-robot Oct 12, 2020
@openshift openshift deleted a comment from openshift-ci-robot Oct 12, 2020
@openshift openshift deleted a comment from openshift-ci-robot Oct 12, 2020
@openshift-ci-robot
Copy link
Contributor

@dtaylor113: This pull request references Bugzilla bug 1885702, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

1 similar comment
@openshift-ci-robot
Copy link
Contributor

@dtaylor113: This pull request references Bugzilla bug 1885702, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

Thanks @dtaylor113

@@ -51,6 +51,7 @@ class DeleteNamespaceModal extends PromiseComponent {
className="pf-c-form-control"
onKeyUp={this._matchTypedNamespace}
placeholder="Enter name"
aria-label="Enter name of namespace to delete"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
aria-label="Enter name of namespace to delete"
aria-label={`Enter the name of the ${this.props.kind.label} to delete`}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, ty

@openshift-ci-robot
Copy link
Contributor

@dtaylor113: This pull request references Bugzilla bug 1885702, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

…t instead of 'modal-container'.

setAppElement(...) will set 'aria-hidden=true' in attempt to hide app behind the open modal.
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dtaylor113, spadgett

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 13, 2020
@dtaylor113
Copy link
Contributor Author

/retest

@jessiehuff
Copy link
Contributor

Really great work on this, @dtaylor113!!! 🎉 I just tested this in VO, and it's significantly better than before. Before these changes, I was unable to interact with the modal outside of the input. I could not navigate to the header, the text, or the footer buttons- I was only able to interact with the input which did not give much context to what was happening either. I was also able to interact with the rest of the page which should have been hidden from the user while interacting with the modal. With these changes, when the user opens the modal now, they aren't confused by the rest of the page, and you added more context with the aria label. My focus goes to the input, it explains what I should do, and if I want more info, I can go up and read the rest of the modal. Awesome update! 😄

@dtaylor113
Copy link
Contributor Author

Really great work on this, @dtaylor113!!! I just tested this in VO...

@jessiehuff Thanks! Really cool that you can experience what these changes actually do. :-)

@spadgett
Copy link
Member

/refresh

@openshift-merge-robot openshift-merge-robot merged commit e9d99ac into openshift:master Oct 14, 2020
@openshift-ci-robot
Copy link
Contributor

@dtaylor113: All pull requests linked via external trackers have merged:

Bugzilla bug 1885702 has been moved to the MODIFIED state.

In response to this:

Bug 1885702: Cypress: Fix 'aria-hidden-focus' accesibility violations

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett
Copy link
Member

/cherry-pick release-4.6

@openshift-cherrypick-robot

@spadgett: new pull request created: #6931

In response to this:

/cherry-pick release-4.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants