Skip to content

Commit 3a9a5d3

Browse files
karenrasmussensanticomp2014
authored andcommitted
Remove keyboard shortcut key
1 parent 0364396 commit 3a9a5d3

3 files changed

Lines changed: 1 addition & 40 deletions

File tree

src/shared/shortcut-config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useEffect, useState } from 'preact/hooks';
22

33
export type ShortcutId =
44
| 'applyUpdates'
5-
| 'openKeyboardShortcuts'
65
| 'openSearch'
76
| 'annotateSelection'
87
| 'highlightSelection'
@@ -26,7 +25,6 @@ export type ShortcutDefinition = {
2625
// Default shortcuts
2726
const defaultShortcuts: ShortcutMap = {
2827
applyUpdates: 'l',
29-
openKeyboardShortcuts: 'k',
3028
openSearch: '/',
3129
annotateSelection: 'a',
3230
highlightSelection: 'h',
@@ -168,12 +166,6 @@ export const shortcutDefinitions: ShortcutDefinition[] = [
168166
description: 'Loads new/updated annotations in the Sidebar.',
169167
group: 'Sidebar',
170168
},
171-
{
172-
id: 'openKeyboardShortcuts',
173-
label: 'Open keyboard shortcuts',
174-
description: 'Open the keyboard shortcuts settings.',
175-
group: 'Sidebar',
176-
},
177169
{
178170
id: 'openSearch',
179171
label: 'Search',

src/sidebar/components/UserMenu.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { ProfileIcon } from '@hypothesis/frontend-shared';
2-
import { useCallback, useState } from 'preact/hooks';
2+
import { useState } from 'preact/hooks';
33

4-
import { useShortcut } from '../../shared/shortcut';
5-
import { useShortcutsConfig } from '../../shared/shortcut-config';
64
import type { Service, SidebarSettings } from '../../types/config';
75
import { serviceConfig } from '../config/service-config';
86
import {
@@ -92,16 +90,6 @@ function UserMenu({ frameSync, onLogout, settings }: UserMenuProps) {
9290
</span>
9391
);
9492

95-
const shortcuts = useShortcutsConfig();
96-
97-
const openKeyboardShortcuts = useCallback((event?: KeyboardEvent) => {
98-
event?.preventDefault();
99-
setShortcutsOpen(true);
100-
setOpen(false);
101-
}, []);
102-
103-
useShortcut(shortcuts.openKeyboardShortcuts, openKeyboardShortcuts);
104-
10593
return (
10694
<>
10795
{/* Allow keyboard shortcut 'n' to open Notebook */}

src/sidebar/components/test/UserMenu-test.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe('UserMenu', () => {
1313
let fakeSettings;
1414
let fakeStore;
1515
let fakeIsFeatureEnabled;
16-
let fakeShortcuts;
1716

1817
const createUserMenu = () => {
1918
return mount(
@@ -44,7 +43,6 @@ describe('UserMenu', () => {
4443
fakeServiceConfig = sinon.stub();
4544
fakeSettings = {};
4645
fakeIsFeatureEnabled = sinon.stub().returns(false);
47-
fakeShortcuts = { openKeyboardShortcuts: 'k' };
4846
fakeStore = {
4947
defaultAuthority: sinon.stub().returns('hypothes.is'),
5048
focusedGroupId: sinon.stub().returns('mygroup'),
@@ -60,9 +58,6 @@ describe('UserMenu', () => {
6058
isThirdPartyUser: fakeIsThirdPartyUser,
6159
},
6260
'../config/service-config': { serviceConfig: fakeServiceConfig },
63-
'../../shared/shortcut-config': {
64-
useShortcutsConfig: () => fakeShortcuts,
65-
},
6661
'../store': { useSidebarStore: () => fakeStore },
6762
});
6863
});
@@ -328,20 +323,6 @@ describe('UserMenu', () => {
328323

329324
assert.isFalse(wrapper.find('KeyboardShortcutsModal').prop('open'));
330325
});
331-
332-
it('opens the shortcuts modal and closes the menu when shortcut is pressed', () => {
333-
const wrapper = createUserMenu();
334-
335-
act(() => {
336-
document.documentElement.dispatchEvent(
337-
new KeyboardEvent('keydown', { key: 'k' }),
338-
);
339-
});
340-
wrapper.update();
341-
342-
assert.isFalse(wrapper.find('Menu').props().open);
343-
assert.isTrue(wrapper.find('KeyboardShortcutsModal').prop('open'));
344-
});
345326
});
346327

347328
describe('log out menu item', () => {

0 commit comments

Comments
 (0)