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
3 changes: 3 additions & 0 deletions data/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ search:
beta_tag: Beta
return_to_search: Return to search
clear_search_query: Clear
close_search: Close search
view_all_search_results: View more results
view_all_search_results_with_count: View all {{n}} results
no_results_found: No results found
no_results_found_announcement: 'Search Docs: No results found'
loading_results_announcement: Loading search results
search_docs_with_query: Search docs for "{{query}}"
privacy_disclaimer: For product and service improvement purposes, GitHub will retain questions and answers generated in the Docs search function. Please see the <a href="https://docs.github.com/privacy"><u>GitHub Privacy Statement</u></a> to review how GitHub collects and uses your data.
ai:
Expand Down
3 changes: 3 additions & 0 deletions src/fixtures/fixtures/data/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ search:
beta_tag: Beta
return_to_search: Return to search
clear_search_query: Clear
close_search: Close search
view_all_search_results: View more results
view_all_search_results_with_count: View all {{n}} results
no_results_found: No results found
no_results_found_announcement: 'Search Docs: No results found'
loading_results_announcement: Loading search results
search_docs_with_query: Search docs for "{{query}}"
privacy_disclaimer: For product and service improvement purposes, GitHub will retain questions and answers generated in the Docs search function. Please see the <a href="https://docs.github.com/privacy"><u>GitHub Privacy Statement</u></a> to review how GitHub collects and uses your data.
ai:
Expand Down
45 changes: 45 additions & 0 deletions src/fixtures/tests/playwright-a11y.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,48 @@ test.describe('search filters (narrow viewport)', () => {
expect(accessibilityScanResults.violations).toEqual([])
})
})

// The search overlay has never been axe-scanned: the `search` entry above covers the
// results page, and nothing opened the dialog. It is now a hand-rolled listbox with
// virtual focus, so its ARIA is worth asserting rather than assuming.
test.describe('search overlay', () => {
test.skip(!SEARCH_TESTS, 'No local Elasticsearch, no tests involving search')

test('open suggestions listbox passes axe', async ({ page }) => {
await page.goto('/')
await turnOffExperimentsInPage(page)

await page.getByTestId('toggle-search').click()
await page.getByTestId('overlay-search-input').fill('serve playwright')
await expect(page.getByTestId('view-all-results')).toBeVisible()

// Scoped to the dialog: the page behind the scrim has its own entry, and scanning
// both would attribute unrelated violations to this component.
const accessibilityScanResults = await new AxeBuilder({ page })
.include('[role="dialog"]')
.analyze()

expect(accessibilityScanResults.violations).toEqual([])
})

test('listbox with an option selected passes axe', async ({ page }) => {
await page.goto('/')
await turnOffExperimentsInPage(page)

await page.getByTestId('toggle-search').click()
const input = page.getByTestId('overlay-search-input')
await input.fill('serve playwright')
await expect(page.getByTestId('view-all-results')).toBeVisible()

// aria-activedescendant only points at something once a row is selected, so the
// unselected scan above cannot catch a broken reference.
await page.keyboard.press('ArrowDown')
await expect(input).toHaveAttribute('aria-activedescendant', /search-option-/)

const accessibilityScanResults = await new AxeBuilder({ page })
.include('[role="dialog"]')
.analyze()

expect(accessibilityScanResults.violations).toEqual([])
})
})
Loading
Loading