You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From display: contents testing work, we've identified opportunities to expand testing coverage in accessibility interop to include keyboard testing.
Common keyboard web accessibility issues which may be WPT-testable include:
lack of focusability (i.e., an element is neither tabbable nor programmatically focusable)
keyboard traps (i.e., an element may receive focus but focus cannot subsequently be moved to the previous/next focusable element)
general lack of expected keyboard operability (e.g., a button-like element is not operable with Enter/Return or Spacebar)
focus management issues (e.g., dismissing <dialog> or alert() element should return focus to the triggering control)
modal interfaces that don't hide hidden/inert controls outside the modal window
missing visible keyboard focus indication (likely non-trivial but may be possible!)
Current WPT keyboard APIs/utilities and proposed stuff
In addition to our currently utilized test_driver.get_computed_label() and test_driver.get_computed_role() functions, testdriver.js includes APIs for actions such as keyboard operation (testdriver-actions.js Actions API).
testdriver-actions.js has a number of functions to simulate keyboard operation (such as .keyUp()) however, accessibility-focused utilities that address common a11y issues like the above are unavailable.
Some proposed new keyboard testing functions:
isFocusable(): uses assert_equals() and JS .focus() to verify document.activeElement; alternatively, we could simulate a Tab key press and check that the element is focused
isTabbable: uses test_driver.send_keys() to operate an element with the Tab key
isFocused(): e.g., when a modal overlay is dismissed, checks that the appropriate element has focus
isNotFocused(): uses assert_not_equals() to verify that the current element is not document.activeElement (or has been keyboard-navigated away from)
isKeyboardOperable(someKeys): given a set of keys, ensure that pressing them dispatches appropriate event
verifyFocusIsTrapped(): given a DOM node, walks all focusable descendants and ensures that only they are in the focus/tab order
verifyFocusOutline(): check if an element draws a focus ring
These could be written as either a common WPT utility, or set of functions exposed by testdriver.js. I recognize that some of these tests may belong outside of accessibility interop, and likely tested outside of it too, but it could simplify/support external testing efforts as well to standardize WPT keyboard testing.
General examples of keyboard testing in other WPT areas
I've identified some notable existing keyboard-focused tests to see how such testing is handled:
From display: contents testing work, we've identified opportunities to expand testing coverage in accessibility interop to include keyboard testing.
Common keyboard web accessibility issues which may be WPT-testable include:
<dialog>
oralert()
element should return focus to the triggering control)Current WPT keyboard APIs/utilities and proposed stuff
In addition to our currently utilized
test_driver.get_computed_label()
andtest_driver.get_computed_role()
functions,testdriver.js
includes APIs for actions such as keyboard operation (testdriver-actions.js Actions API).testdriver-actions.js has a number of functions to simulate keyboard operation (such as
.keyUp()
) however, accessibility-focused utilities that address common a11y issues like the above are unavailable.Some proposed new keyboard testing functions:
isFocusable()
: usesassert_equals()
and JS.focus()
to verifydocument.activeElement
; alternatively, we could simulate a Tab key press and check that the element is focusedisTabbable
: usestest_driver.send_keys()
to operate an element with the Tab keyisFocused()
: e.g., when a modal overlay is dismissed, checks that the appropriate element has focusisNotFocused()
: usesassert_not_equals()
to verify that the current element is notdocument.activeElement
(or has been keyboard-navigated away from)isKeyboardOperable(someKeys)
: given a set of keys, ensure that pressing them dispatches appropriate eventverifyFocusIsTrapped()
: given a DOM node, walks all focusable descendants and ensures that only they are in the focus/tab orderverifyFocusOutline()
: check if an element draws a focus ringThese could be written as either a common WPT utility, or set of functions exposed by
testdriver.js
. I recognize that some of these tests may belong outside of accessibility interop, and likely tested outside of it too, but it could simplify/support external testing efforts as well to standardize WPT keyboard testing.General examples of keyboard testing in other WPT areas
I've identified some notable existing keyboard-focused tests to see how such testing is handled:
click
eventdisplay: none
element is not focusabletabindex
should be non-focusableautofocus
teststabindex
testspopover
is not focusableGenerally, existing tests rely on
test_driver.send_keys()
,document.activeElement
, JS.focus()
and WPTassert...()
functions for keyboard testing.The text was updated successfully, but these errors were encountered: