diff --git a/packages/session-ui/src/v2/components/session-review-v2.tsx b/packages/session-ui/src/v2/components/session-review-v2.tsx
index abbe90d11266..bfd6778c541e 100644
--- a/packages/session-ui/src/v2/components/session-review-v2.tsx
+++ b/packages/session-ui/src/v2/components/session-review-v2.tsx
@@ -165,11 +165,13 @@ export function SessionReviewV2(props: SessionReviewV2Props) {
}
const prev = () => {
- return props.files[fileIndex() - 1]
+ if (!canCycle()) return
+ return props.files[(fileIndex() - 1 + props.files.length) % props.files.length]
}
const next = () => {
- return props.files[fileIndex() + 1]
+ if (!canCycle()) return
+ return props.files[(fileIndex() + 1) % props.files.length]
}
const canCycle = () => props.files.length > 0
@@ -183,15 +185,15 @@ export function SessionReviewV2(props: SessionReviewV2Props) {
props.onSelectFile(file)
}
- // The prev/next tooltips advertise < and >; keep the keys working while the
+ // Keep the advertised arrow keys working while the
// pane is mounted, but never while typing in an input or comment editor.
makeEventListener(document, "keydown", (event) => {
if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey) return
- if (event.key !== "<" && event.key !== ">") return
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return
const target = event.target
if (target instanceof HTMLElement && (target.isContentEditable || target.closest("input, textarea, select"))) return
if (!props.hasDiffs || !canCycle()) return
- const file = event.key === "<" ? prev() : next()
+ const file = event.key === "ArrowLeft" ? prev() : next()
if (!file) return
event.preventDefault()
cycle(file)
@@ -219,7 +221,7 @@ export function SessionReviewV2(props: SessionReviewV2Props) {
value={
<>
{i18n.t("ui.sessionReviewV2.previousFile")}
-
+
>
}
>
@@ -239,7 +241,7 @@ export function SessionReviewV2(props: SessionReviewV2Props) {
value={
<>
{i18n.t("ui.sessionReviewV2.nextFile")}
- "]} variant="neutral" />
+
>
}
>