1
0
Fork 0

feat: enable Cmd+K shortcut when caps lock is on (#1590)

This commit is contained in:
Alexey Pyltsyn 2022-10-23 15:07:41 +03:00 committed by GitHub
parent 161acf063e
commit d13ded1cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -15,11 +15,21 @@ describe('Start', () => {
cy.modalIsVisibleAndFocused();
});
it('Open modal with key shortcut on Windows/Linux when caps lock is on', () => {
cy.get('body').type('{ctrl}K');
cy.modalIsVisibleAndFocused();
});
it('Open modal with key shortcut on macOS', () => {
cy.get('body').type('{meta}k');
cy.modalIsVisibleAndFocused();
});
it('Open modal with key shortcut on macOS when caps lock is on', () => {
cy.get('body').type('{meta}K');
cy.modalIsVisibleAndFocused();
});
it('Open modal with forward slash key shortcut', () => {
cy.get('body').type('/');
cy.modalIsVisibleAndFocused();

View file

@ -39,7 +39,7 @@ export function useDocSearchKeyboardEvents({
if (
(event.keyCode === 27 && isOpen) ||
// The `Cmd+K` shortcut both opens and closes the modal.
(event.key === 'k' && (event.metaKey || event.ctrlKey)) ||
(event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey)) ||
// The `/` shortcut opens but doesn't close the modal because it's
// a character.
(!isEditingContent(event) && event.key === '/' && !isOpen)