]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18938 Fix keyboard navigation when on Code page
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 2 May 2023 15:51:01 +0000 (17:51 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 4 May 2023 20:03:11 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx

index 4f0070d244d68703ce3e8f92500efd230927b2a1..6949d250dd7af96e68072324b35d94fbb1d037b7 100644 (file)
@@ -55,14 +55,13 @@ export default function withKeyboardNavigation<P>(
         return true;
       }
       if (event.key === KeyboardKeys.UpArrow) {
-        return this.skipIfFile(event, this.handleHighlightPrevious);
+        return this.skipIfFile(this.handleHighlightPrevious);
       } else if (event.key === KeyboardKeys.DownArrow) {
-        return this.skipIfFile(event, this.handleHighlightNext);
+        return this.skipIfFile(this.handleHighlightNext);
       } else if (event.key === KeyboardKeys.RightArrow || event.key === KeyboardKeys.Enter) {
-        return this.skipIfFile(event, this.handleSelectCurrent);
+        return this.skipIfFile(this.handleSelectCurrent);
       } else if (event.key === KeyboardKeys.LeftArrow) {
         this.handleSelectParent();
-        return false; // always hijack left / Why did you put this @wouter?
       }
       return true;
     };
@@ -77,11 +76,10 @@ export default function withKeyboardNavigation<P>(
         : -1;
     };
 
-    skipIfFile = (event: KeyboardEvent, handler: () => void) => {
+    skipIfFile = (handler: () => void) => {
       if (this.props.isFile) {
         return true;
       }
-      event.preventDefault();
       handler();
       return false;
     };