From d4d4f6188ba7955e62a70b12182dd4cd748e7322 Mon Sep 17 00:00:00 2001 From: ryan-opatka <114194686+ryan-opatka@users.noreply.github.com> Date: Sun, 22 Nov 2026 17:33:09 -0600 Subject: [PATCH] fix: find the animating square by id so custom board ids cannot crash The piece animation looked up its source square with document.querySelector(`#${id}-square-...`). Ids that are not valid CSS selectors (e.g. "1-board", "board:1", or React's useId() output like ":r0:") made querySelector throw a SyntaxError on the first animated move, unmounting the app. Ids containing "." silently skipped the animation. Use document.getElementById, as utils.ts already does for the same `${id}-square-${squareId}` element. Co-Authored-By: Claude Opus 5.5 --- src/Piece.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Piece.tsx b/src/Piece.tsx index b18e4e4..38641e6 100644 --- a/src/Piece.tsx +++ b/src/Piece.tsx @@ -52,7 +52,7 @@ export const Piece = memo(function Piece({ const targetSquare = positionDifferences[position]; const squareWidth = document - .querySelector(`#${id}-square-${sourceSquare}`) + .getElementById(`${id}-square-${sourceSquare}`) ?.getBoundingClientRect().width; if (!squareWidth) {