Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix site editor region navigation (#36709)
* Implement shortcuts and labels * Use correct key for body * Fix focusing navigation sidebar when navigating regions * Only use detailed region labels when post type has loaded
- Loading branch information
1 parent
3d6c09c
commit 5c2964e
Showing
5 changed files
with
139 additions
and
2 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
45 changes: 45 additions & 0 deletions
45
packages/edit-site/src/components/list/use-register-shortcuts.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,45 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
|
||
import { useDispatch } from '@wordpress/data'; | ||
import { useEffect } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; | ||
|
||
export default function useRegisterShortcuts() { | ||
const { registerShortcut } = useDispatch( keyboardShortcutsStore ); | ||
useEffect( () => { | ||
registerShortcut( { | ||
name: 'core/edit-site/next-region', | ||
category: 'global', | ||
description: __( 'Navigate to the next part of the editor.' ), | ||
keyCombination: { | ||
modifier: 'ctrl', | ||
character: '`', | ||
}, | ||
aliases: [ | ||
{ | ||
modifier: 'access', | ||
character: 'n', | ||
}, | ||
], | ||
} ); | ||
|
||
registerShortcut( { | ||
name: 'core/edit-site/previous-region', | ||
category: 'global', | ||
description: __( 'Navigate to the previous part of the editor.' ), | ||
keyCombination: { | ||
modifier: 'ctrlShift', | ||
character: '`', | ||
}, | ||
aliases: [ | ||
{ | ||
modifier: 'access', | ||
character: 'p', | ||
}, | ||
], | ||
} ); | ||
}, [] ); | ||
} |
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