]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21185 Remove "c" shortcut for issue comments
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>
Tue, 16 Jan 2024 17:46:30 +0000 (18:46 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 17 Jan 2024 20:02:43 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx
server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx
server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx
server/sonar-web/src/main/js/components/issue/Issue.tsx
server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx
server/sonar-web/src/main/js/helpers/keycodes.ts

index 7b31d67257bfca7d9ad007be34c48b17e425e012..0fbb5ccf0fbae9f0161af0cbf39e73941d9ca682 100644 (file)
  * 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' },
       ],
index 2e825f0966f593362838429b6cead320a73a770c..0ec30c428fb5e654118a3f6d09eb39bbfd6c1092 100644 (file)
@@ -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');
 
index 398913ece16f938de7c1724613b2384fdf4d9fb6..0d549a6b6cf8b42ed18d082cea0273df38f39368 100644 (file)
@@ -109,9 +109,6 @@ export default class IssueHeader extends React.PureComponent<Props, State> {
     } 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');
index d290bd70c306a0c428f213869d5948942e34a4a9..8cafe6ba36b96bf5af9648d1337a07342115925a 100644 (file)
@@ -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');
index 4f2d900eedc04896bf34cac6f7be2bfaf9281fc8..89638fad59646bdbdfa39a7afa687ff2318cded0 100644 (file)
@@ -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}}`);
index 0d269f58dde06993fe7d378499891e388be57bcc..f5a601e02c59930dd6caf8433736bb476cd715d1 100644 (file)
@@ -39,7 +39,6 @@ export enum KeyboardKeys {
   KeyA = 'a',
   KeyM = 'm',
   KeyI = 'i',
-  KeyC = 'c',
   KeyT = 't',
   KeyS = 's',
   KeyQuestionMark = '?',