Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/trace-viewer/src/ui/uiModeFiltersView.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/trace-viewer/src/ui/uiModeFiltersView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'>
Expand Down
19 changes: 19 additions & 0 deletions tests/playwright-test/ui-mode-test-filters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down