-
Notifications
You must be signed in to change notification settings - Fork 6
fix(search|a11y): avoid input focus #1213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5b825bd
fix(search|a11y): announce result count and avoid input focus
abulte a03e5ea
datagouv/components 1.0.2-dev.90
abulte f0f3cac
add e2e
abulte 40499fc
cleanup
abulte b14a53f
simplify
abulte 2975330
announce page
abulte 452a3e4
test page announcement
abulte 522f3e4
Merge branch 'main' into fix/unified-search/live-results
abulte ada770f
remove count annouce
abulte 33a9a36
datagouv/components 1.1.2
abulte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { datasetFactory } from 'cypress/support/factories/datasets_factory' | ||
|
|
||
| describe('Unified search – live result count announcement', () => { | ||
| beforeEach(() => { | ||
| cy.mockMatomo() | ||
| cy.mockStaticDatagouv() | ||
| }) | ||
|
|
||
| it('announces multiple results as "N résultats"', () => { | ||
| cy.mockListApis('datasets', datasetFactory.many(5)) | ||
| cy.visit('/datasets') | ||
| cy.wait('@get_datasets_list') | ||
|
|
||
| cy.get('[aria-live="assertive"]') | ||
| .find('li') | ||
| .last() | ||
| .should('have.text', '5 résultats') | ||
| }) | ||
|
|
||
| it('announces a single result as "1 résultat"', () => { | ||
| cy.mockListApis('datasets', datasetFactory.many(1)) | ||
| cy.visit('/datasets') | ||
| cy.wait('@get_datasets_list') | ||
|
|
||
| cy.get('[aria-live="assertive"]') | ||
| .find('li') | ||
| .last() | ||
| .should('have.text', '1 résultat') | ||
| }) | ||
|
|
||
| it('announces "Aucun résultat" when there are no results', () => { | ||
| cy.mockListApis('datasets', []) | ||
| cy.visit('/datasets') | ||
| cy.wait('@get_datasets_list') | ||
|
|
||
| cy.get('[aria-live="assertive"]') | ||
| .find('li') | ||
| .last() | ||
| .should('have.text', 'Aucun résultat') | ||
| }) | ||
|
|
||
| it('announces page number on pagination', () => { | ||
| cy.mockListApis('datasets', datasetFactory.many(5)) | ||
| cy.visit('/datasets?page=2') | ||
| cy.wait('@get_datasets_list') | ||
|
|
||
| cy.get('[aria-live="assertive"]') | ||
| .find('li') | ||
| .last() | ||
| .should('have.text', 'Page 2, 5 résultats') | ||
| }) | ||
|
|
||
| it('includes the search query in the live-region page title', () => { | ||
| cy.mockListApis('datasets', datasetFactory.many(2)) | ||
| cy.visit('/datasets?q=test') | ||
| cy.wait('@get_datasets_list') | ||
|
|
||
| const { pages, website } = Cypress.env('siteConfig') | ||
| const pageTitle = pages.datasets.title | ||
|
|
||
| cy.get('[aria-live="assertive"]') | ||
| .find('li') | ||
| .first() | ||
| .should('have.text', `Page ${pageTitle} pour "test" | ${website.title}`) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.