Skip to content

Commit 91b112d

Browse files
committed
fix: ensure document is defined before accessing activeElement in currency input
1 parent ecf9646 commit 91b112d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/currency-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function RenderCurrencyInput<BaseType = InputAttributes>(
4040
value = 0;
4141
// when this happens, we want to position the caret at the end
4242
// of the input only if the user is on the input
43-
if (document.activeElement === innerRef.current) {
43+
if (typeof document !== "undefined" && document.activeElement === innerRef.current) {
4444
innerRef.current?.setSelectionRange(
4545
inputValue.length + (minimumFractionDigits ?? 0),
4646
inputValue.length + (minimumFractionDigits ?? 0),

0 commit comments

Comments
 (0)