Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(ui-mode): make the filter summary reachable from the keyboard (#42449)
Huzaifa Iftikharb276e33a88ed
diff --git a/packages/trace-viewer/src/ui/uiModeFiltersView.css b/packages/trace-viewer/src/ui/uiModeFiltersView.cssindex 5967da3e23..52c5fb6568 100644--- a/packages/trace-viewer/src/ui/uiModeFiltersView.css+++ b/packages/trace-viewer/src/ui/uiModeFiltersView.css@@ -35,6 +35,22 @@cursor: pointer;}+/* the summary is a button, strip the browser chrome so it still reads as text */+.filter-summary {+ all: unset;+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ user-select: none;+ cursor: pointer;+}++.filter-summary:focus-visible {+ outline: 1px solid var(--vscode-focusBorder);+ outline-offset: -1px;+}+.filter-label {color: var(--vscode-disabledForeground);}diff --git a/packages/trace-viewer/src/ui/uiModeFiltersView.tsx b/packages/trace-viewer/src/ui/uiModeFiltersView.tsxindex 5066a27d0a..0579a741e1 100644--- a/packages/trace-viewer/src/ui/uiModeFiltersView.tsx+++ b/packages/trace-viewer/src/ui/uiModeFiltersView.tsx@@ -55,11 +55,11 @@ export const FiltersView: React.FC<{runTests();}} />}></Expandable>- <div className='filter-summary' title={'Status: ' + statusLine + '\nProjects: ' + projectsLine + (onlyChanged ? '\nOnly changed' : '')} onClick={() => setExpanded(!expanded)}>+ <button className='filter-summary' aria-expanded={expanded} title={'Status: ' + statusLine + '\nProjects: ' + projectsLine + (onlyChanged ? '\nOnly changed' : '')} onClick={() => setExpanded(!expanded)}><span className='filter-label'>Status:</span> {statusLine}<span className='filter-label'>Projects:</span> {projectsLine}{onlyChanged && <><span className='filter-label'>Only changed</span></>}- </div>+ </button>{expanded && <><div className='hbox' style={{ marginLeft: 14, maxHeight: 200, overflowY: 'auto' }}><div className='filter-list' role='list' data-testid='status-filters'>diff --git a/tests/playwright-test/ui-mode-test-filters.spec.ts b/tests/playwright-test/ui-mode-test-filters.spec.tsindex ef72b00b57..f549d150e4 100644--- a/tests/playwright-test/ui-mode-test-filters.spec.ts+++ b/tests/playwright-test/ui-mode-test-filters.spec.ts@@ -72,6 +72,25 @@ test('should display native tags and filter by them on click', async ({ runUITes`);});+test('should toggle filters from the keyboard', async ({ runUITest }) => {+ const { page } = await runUITest(basicTestTree);+ const summary = page.locator('.filter-summary');++ await expect(summary).toHaveRole('button');+ await expect(summary).toHaveAttribute('aria-expanded', 'false');++ await summary.focus();+ await expect(summary).toBeFocused();++ await summary.press('Enter');+ await expect(page.getByTestId('status-filters')).toBeVisible();+ await expect(summary).toHaveAttribute('aria-expanded', 'true');++ await summary.press('Space');+ await expect(page.getByTestId('status-filters')).toBeHidden();+ await expect(summary).toHaveAttribute('aria-expanded', 'false');+});+test('should filter by status', async ({ runUITest }) => {const { page } = await runUITest(basicTestTree);