Fix DatePicker popup flashing at top-left in Chromium
Latent bug: useEffect runs after paint, so the popup rendered at
{top:0, left:0} before repositioning. Switched to useLayoutEffect
which runs synchronously before paint, ensuring correct position
on first frame. Both Chromium and Firefox unaffected by the change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
63b3a3a073
commit
e20c04ac4f
@ -160,7 +160,7 @@ const DatePicker = React.forwardRef<HTMLButtonElement, DatePickerProps>(
|
|||||||
});
|
});
|
||||||
}, [mode, usesNativeInput]);
|
}, [mode, usesNativeInput]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useLayoutEffect(() => {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
updatePosition();
|
updatePosition();
|
||||||
window.addEventListener('scroll', updatePosition, true);
|
window.addEventListener('scroll', updatePosition, true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user