-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix navigate regions backwards for macOS Firefox and Safari. (#45019)
* Fix navigate regions backwards for macOS Firefox and Safari. * Add changelog entry. * Add Playwright E2E for catching regressions in all 3 browsers. * Adjust the test to cover browsers event.key inconsistency. * Fix typo and add link to PR. Co-authored-by: Alex Stine <alex.stine@yourtechadvisors.com> Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
- Loading branch information
1 parent
d8731ed
commit 4a71aae
Showing
7 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
52 changes: 52 additions & 0 deletions
52
test/e2e/specs/editor/various/a11y-region-navigation.spec.js
This file contains 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,52 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Region navigation (@firefox, @webkit)', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.deleteAllPosts(); | ||
} ); | ||
|
||
test( 'navigates forward and back again', async ( { | ||
editor, | ||
page, | ||
}, testInfo ) => { | ||
// Insert a paragraph block. | ||
await editor.insertBlock( { | ||
name: 'core/paragraph', | ||
attributes: { content: 'Dummy text' }, | ||
} ); | ||
|
||
// Navigate to first region and check that we made it. | ||
await page.keyboard.press( 'Control+`' ); | ||
const editorTopBar = page.locator( | ||
'role=region[name="Editor top bar"i]' | ||
); | ||
await expect( editorTopBar ).toBeFocused(); | ||
|
||
// Navigate to next/second region and check that we made it. | ||
await page.keyboard.press( 'Control+`' ); | ||
const editorContent = page.locator( | ||
'role=region[name="Editor content"i]' | ||
); | ||
await expect( editorContent ).toBeFocused(); | ||
|
||
// Navigate to previous/first region and check that we made it. | ||
// Make sure navigating backwards works also with the tilde character, | ||
// as browsers interpret the combination of the crtl+shift+backtick keys | ||
// and assign it to event.key inconsistently. | ||
// See https://github.com/WordPress/gutenberg/pull/45019 | ||
if ( testInfo.project.name === 'chromium' ) { | ||
await page.keyboard.press( 'Control+Shift+`' ); | ||
} else { | ||
await page.keyboard.press( 'Control+Shift+~' ); | ||
} | ||
|
||
await expect( editorTopBar ).toBeFocused(); | ||
} ); | ||
} ); |