Add focus assertions to JavaScript tests

Created on 20 March 2019, almost 6 years ago
Updated 26 May 2023, over 1 year ago

Problem/Motivation

In working on Media Library, we paid a lot of attention to accessibility issues and fixed many problems in that space. We also tested our fixes. Many of the problems (and fixes) were related to where the focus goes while the user interacts with the UI. To facilitate more accessibility testing in JavaScript tests, it would be great if we had a way to assert that a particular element has, or does not have, focus.

Proposed resolution

Add two methods to JsWebAssert: assertElementHasFocus() and assertElementNotHasFocus().

Remaining tasks

Implement it, review it, commit it, and start using it!

User interface changes

None.

API changes

JsWebAssert, and therefore all JavaScript tests, will receive new assertion methods.

Data model changes

None.

Release notes snippet

TBD

Feature request
Status

Needs work

Version

11.0 🔥

Component
PHPUnit 

Last updated 1 day ago

Created by

🇺🇸United States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024