Skip to content

Commit 584eed1

Browse files
fix: prevent navigating to moves before drill in DrillPerformanceModal
1 parent 18b2b68 commit 584eed1

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/components/Board/MovesContainer.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,16 @@ export const MovesContainer: React.FC<
129129
break
130130
case 'ArrowLeft':
131131
event.preventDefault()
132-
if (controller.currentNode.parent) {
133-
// Check if navigation is restricted
134-
if (
135-
restrictNavigationBefore &&
136-
controller.currentNode.parent.fen === restrictNavigationBefore.fen
137-
) {
138-
// Don't navigate before the restriction point
139-
return
140-
}
141-
controller.goToNode(controller.currentNode.parent)
132+
if (!controller.currentNode?.parent) return
133+
// Treat restrictNavigationBefore as the earliest allowed node
134+
if (
135+
restrictNavigationBefore &&
136+
controller.currentNode.fen === restrictNavigationBefore.fen
137+
) {
138+
// Already at the boundary; do not go earlier
139+
return
142140
}
141+
controller.goToNode(controller.currentNode.parent)
143142
break
144143
default:
145144
break

0 commit comments

Comments
 (0)