Skip to content

Commit 5b53681

Browse files
committed
fix: prevent scroll on focus
1 parent 1313711 commit 5b53681

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/components/DatePicker/hooks/useDatePickerProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function useDatePickerProps<T extends DateTime | RangeValue<DateTime>>(
7878

7979
function focusInput() {
8080
setTimeout(() => {
81-
inputRef.current?.focus();
81+
inputRef.current?.focus({preventScroll: true});
8282
});
8383
}
8484

src/components/RelativeDatePicker/hooks/useRelativeDatePickerProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function useRelativeDatePickerProps(
125125

126126
function focusInput() {
127127
setTimeout(() => {
128-
inputRef.current?.focus();
128+
inputRef.current?.focus({preventScroll: true});
129129
});
130130
}
131131
const groupRef = React.useRef<HTMLElement>(null);

src/components/RelativeRangeDatePicker/RelativeRangeDatePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export function RelativeRangeDatePicker(props: RelativeRangeDatePickerProps) {
252252
}}
253253
focusInput={() => {
254254
setTimeout(() => {
255-
inputRef.current?.focus();
255+
inputRef.current?.focus({preventScroll: true});
256256
});
257257
}}
258258
anchorRef={anchorRef}

0 commit comments

Comments
 (0)