mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 22:23:50 +03:00
Merge pull request 'Accessibility: Taborder in repo explore' (#2636) from fnetx/explore-taborder into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2636 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
226fa396df
2 changed files with 40 additions and 0 deletions
39
tests/e2e/explore.test.e2e.js
Normal file
39
tests/e2e/explore.test.e2e.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
// @ts-check
|
||||
// document is a global in evaluate, so it's safe to ignore here
|
||||
/* eslint no-undef: 0 */
|
||||
import {test, expect} from '@playwright/test';
|
||||
|
||||
test('Explore view taborder', async ({page}) => {
|
||||
await page.goto('/explore/repos');
|
||||
|
||||
const l1 = page.locator('[href="https://forgejo.org"]');
|
||||
const l2 = page.locator('[href="/assets/licenses.txt"]');
|
||||
const l3 = page.locator('[href*="/stars"]').first();
|
||||
const l4 = page.locator('[href*="/forks"]').first();
|
||||
let res = 0;
|
||||
const exp = 15; // 0b1111 = four passing tests
|
||||
|
||||
for (let i = 0; i < 150; i++) {
|
||||
await page.keyboard.press('Tab');
|
||||
if (await l1.evaluate((node) => document.activeElement === node)) {
|
||||
res |= 1;
|
||||
continue;
|
||||
}
|
||||
if (await l2.evaluate((node) => document.activeElement === node)) {
|
||||
res |= 1 << 1;
|
||||
continue;
|
||||
}
|
||||
if (await l3.evaluate((node) => document.activeElement === node)) {
|
||||
res |= 1 << 2;
|
||||
continue;
|
||||
}
|
||||
if (await l4.evaluate((node) => document.activeElement === node)) {
|
||||
res |= 1 << 3;
|
||||
continue;
|
||||
}
|
||||
if (res === exp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
await expect(res).toBe(exp);
|
||||
});
|
|
@ -39,6 +39,7 @@ function updateMenuItem(dropdown, item) {
|
|||
item.setAttribute('role', dropdown[ariaPatchKey].listItemRole);
|
||||
item.setAttribute('tabindex', '-1');
|
||||
for (const a of item.querySelectorAll('a')) a.setAttribute('tabindex', '-1');
|
||||
for (const input of item.querySelectorAll('input')) input.setAttribute('tabindex', '-1');
|
||||
}
|
||||
|
||||
// make the label item and its "delete icon" has correct aria attributes
|
||||
|
|
Loading…
Reference in a new issue