From d761fbd31512343a4cb839ddd4185d90ec44b1e2 Mon Sep 17 00:00:00 2001 From: David Cho-Lerat Date: Tue, 16 Jan 2024 18:46:30 +0100 Subject: [PATCH] SONAR-21185 Remove "c" shortcut for issue comments --- .../main/js/app/components/KeyboardShortcutsModal.tsx | 4 ++-- .../src/main/js/apps/issues/__tests__/IssueApp-it.tsx | 6 ------ .../src/main/js/apps/issues/components/IssueHeader.tsx | 3 --- server/sonar-web/src/main/js/components/issue/Issue.tsx | 3 --- .../src/main/js/components/issue/__tests__/Issue-it.tsx | 9 --------- server/sonar-web/src/main/js/helpers/keycodes.ts | 1 - 6 files changed, 2 insertions(+), 24 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx index 7b31d67257b..0fbb5ccf0fb 100644 --- a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx +++ b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx @@ -17,10 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import * as React from 'react'; import Link from '../../components/common/Link'; -import { Button } from '../../components/controls/buttons'; import Modal from '../../components/controls/Modal'; +import { Button } from '../../components/controls/buttons'; import { isInput } from '../../helpers/keyboardEventHelpers'; import { KeyboardKeys } from '../../helpers/keycodes'; import { translate } from '../../helpers/l10n'; @@ -55,7 +56,6 @@ const CATEGORIES: { left: Shortcuts; right: Shortcuts } = { { keys: ['a'], action: 'assign' }, { keys: ['m'], action: 'assign_to_me' }, { keys: ['i'], action: 'severity' }, - { keys: ['c'], action: 'comment' }, { keys: ['ctrl', '+', 'enter'], action: 'submit_comment' }, { keys: ['t'], action: 'tags' }, ], diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index 2e825f0966f..0ec30c428fb 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -301,12 +301,6 @@ describe('issue app', () => { expect(screen.getByText('issue.transition.confirm')).toBeInTheDocument(); expect(screen.getByText('issue.transition.resolve')).toBeInTheDocument(); - // Open comment popup on key press 'c' - await user.keyboard('c'); - - expect(screen.getByText('issue.comment.formlink')).toBeInTheDocument(); - await user.keyboard('{Escape}'); - // Open tags popup on key press 't' await user.keyboard('t'); diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx index 398913ece16..0d549a6b6cf 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx @@ -109,9 +109,6 @@ export default class IssueHeader extends React.PureComponent { } else if (event.key === KeyboardKeys.KeyM && this.props.issue.actions.includes('assign')) { event.preventDefault(); return this.handleAssignement('_me'); - } else if (event.key === KeyboardKeys.KeyC) { - event.preventDefault(); - return this.handleIssuePopupToggle('comment'); } else if (event.key === KeyboardKeys.KeyT) { event.preventDefault(); return this.handleIssuePopupToggle('edit-tags'); diff --git a/server/sonar-web/src/main/js/components/issue/Issue.tsx b/server/sonar-web/src/main/js/components/issue/Issue.tsx index d290bd70c30..8cafe6ba36b 100644 --- a/server/sonar-web/src/main/js/components/issue/Issue.tsx +++ b/server/sonar-web/src/main/js/components/issue/Issue.tsx @@ -92,9 +92,6 @@ export default function Issue(props: Props) { } else if (event.key === KeyboardKeys.KeyI) { event.preventDefault(); return togglePopup('set-severity'); - } else if (event.key === KeyboardKeys.KeyC) { - event.preventDefault(); - return togglePopup('comment'); } else if (event.key === KeyboardKeys.KeyT) { event.preventDefault(); return togglePopup('edit-tags'); diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx index 4f2d900eedc..89638fad596 100644 --- a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx +++ b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx @@ -162,10 +162,6 @@ it('should correctly handle keyboard shortcuts', async () => { expect(ui.setAssigneeBtn(/Organa/).get()).toBeInTheDocument(); await ui.pressDismissShortcut(); - await ui.pressCommentShortcut(); - expect(ui.commentTextInput.get()).toBeInTheDocument(); - await ui.pressDismissShortcut(); - await ui.pressTagsShortcut(); expect(ui.tagsSearchInput.get()).toBeInTheDocument(); await ui.pressDismissShortcut(); @@ -355,11 +351,6 @@ function getPageObject() { await user.keyboard(`{${KeyboardKeys.KeyI}}`); }); }, - async pressCommentShortcut() { - await act(async () => { - await user.keyboard(`{${KeyboardKeys.KeyC}}`); - }); - }, async pressTagsShortcut() { await act(async () => { await user.keyboard(`{${KeyboardKeys.KeyT}}`); diff --git a/server/sonar-web/src/main/js/helpers/keycodes.ts b/server/sonar-web/src/main/js/helpers/keycodes.ts index 0d269f58dde..f5a601e02c5 100644 --- a/server/sonar-web/src/main/js/helpers/keycodes.ts +++ b/server/sonar-web/src/main/js/helpers/keycodes.ts @@ -39,7 +39,6 @@ export enum KeyboardKeys { KeyA = 'a', KeyM = 'm', KeyI = 'i', - KeyC = 'c', KeyT = 't', KeyS = 's', KeyQuestionMark = '?', -- 2.39.5