diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 1e97fa1c898f..a5d06d5c769c 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -305,8 +305,8 @@ async function updateDOM( activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement ) { - start && (activeElement.selectionStart = start); - end && (activeElement.selectionEnd = end); + if (typeof start === 'number') activeElement.selectionStart = start; + if (typeof end === 'number') activeElement.selectionEnd = end; } } };