From d43927c62a94a3d6f9b12ef0b4b7a1f9418b560c Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 2 May 2023 17:51:01 +0200 Subject: [PATCH] SONAR-18938 Fix keyboard navigation when on Code page --- .../main/js/components/hoc/withKeyboardNavigation.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx b/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx index 4f0070d244d..6949d250dd7 100644 --- a/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx +++ b/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx @@ -55,14 +55,13 @@ export default function withKeyboardNavigation

( 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

( : -1; }; - skipIfFile = (event: KeyboardEvent, handler: () => void) => { + skipIfFile = (handler: () => void) => { if (this.props.isFile) { return true; } - event.preventDefault(); handler(); return false; }; -- 2.39.5