From 49179dd806992b9ab99b4de4491887a8d6388e54 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Wed, 29 May 2024 11:31:38 +0300 Subject: [PATCH] Fix alt + arrows navigation --- .../frontend/src/pages/RSFormPage/RSTabs.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx index b2bf12ad..5315eab8 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx @@ -107,7 +107,22 @@ function RSTabs() { [router, schema, activeTab, version] ); - function onSelectTab(index: number) { + function onSelectTab(index: number, last: number, event: Event) { + if (last === index) { + return; + } + if (event.type == 'keydown') { + const kbEvent = event as KeyboardEvent; + if (kbEvent.altKey) { + if (kbEvent.code === 'ArrowLeft') { + router.back(); + return; + } else if (kbEvent.code === 'ArrowRight') { + router.forward(); + return; + } + } + } navigateTab(index, selected.length > 0 ? selected.at(-1) : undefined); }