NEW 273843
Support: Shift + Tab keys for test_driver.send_keys()
https://bugs.webkit.org/show_bug.cgi?id=273843
Summary Support: Shift + Tab keys for test_driver.send_keys()
James Craig
Reported 2024-05-07 14:43:09 PDT
Rahim wrote the following. I'm filing on his behalf. --------------------------------------------------------- I currently working on a Web Platform Tests (WPT) pull request for adding keyboard testing to WPT’s common utils: https://github.com/web-platform-tests/wpt/pull/44347. This will allow us to include keyboard tests as part of Accessibility Interop work: https://github.com/web-platform-tests/interop-accessibility. One of the keyboard testing functions I’ve written in the proposed wpt/common/keyboard-utils.js file is verifyElementsDoNotCauseKeyboardTrap() which given a focusable test element, confirms that keyboard focus can be moved away from (via Shift + Tab), and back to (via Tab), the focusable test element. In keyboard-utils.js, I’ve set up a “keys” object: =================== const keys = { // See WebDriver key codepoints: https://w3c.github.io/webdriver/#keyboard-actions "LeftShiftAndTab": "\uE008" + "\uE004", // Left Shift = \uE008 and Right Shift = \uE050 however, they should be indistinguishable "Tab": "\uE004", }; =================== And when I want to move focus away from the tested element in my verifyElementsDoNotCauseKeyboardTrap() function: =================== await test_driver.send_keys(el, keys.LeftShiftAndTab); =================== It appears that both Chromium/Gecko’s test_driver.send_keys() implementations support a Shift + Tab concurrent key press however, my WebKit tests for this function fail due to lack of support for sending Shift and Tab keys simultaneously. I’ve tried the codepoints for both Left Shift ( \uE008) and Right Shift (\uE050) in combination with Tab (\uE004) and both fail in only WebKit. Please see the attached test results for Chrome and Safari (Firefox’s results all pass like Chrome so I haven’t included it). I see this resolved bug addressing modifier key support in our testdriver-vendor.js so perhaps it’s only the Shift key that’s not supported as a modifier: https://bugs.webkit.org/show_bug.cgi?id=221465. *Note: In my PR (https://github.com/web-platform-tests/wpt/pull/44347), I’ve temporarily added some tests in wpt/accessibility/keyboard/keyboard-utils-test.html for quick testing; however, this test file will not be checked in but can be used to test the verifyElementsDoNotCauseKeyboardTrap() function across engines. I’m testing my function with the keyboard-utils-test.html file by running the following WPT CLI command for each browser: - Safari = ./wpt run --log-mach-level debug --log-mach - --webdriver-arg="--diagnose" safari <local path to keyboard-utils-test.html> - Chrome = ./wpt run --log-mach-level debug --log-mach - --webdriver-arg="--diagnose" chrome <local path to keyboard-utils-test.html> - Firefox = ./wpt run --log-mach-level debug --log-mach - --webdriver-arg="--diagnose" firefox <local path to keyboard-utils-test.html>
Attachments
James Craig
Comment 1 2024-05-07 14:43:22 PDT
Note You need to log in before you can comment on or make changes to this bug.