You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For rc-picker used by TimePicker, I found the code below in useScrollTo.ts seemed to be buggy. After selecting a time from the time panel, the panel ul will scroll to the target li position. But when the target li is reaching top, the scrolling is not stopped, causing the scroll event could not be triggered on mouse-wheel scrolling.
// Break if dist get larger, which means user is scrollingif(scrollDistRef.current!==null&&scrollDistRef.current<dist){stopScroll();return;}scrollDistRef.current=dist;
When the scenario above happens, the scrollDistRef.current is always equal to dist. So the stopScroll will be never called.
As I observed, on the latest Chrome, the scroll event can be fired even if the scrolling is not stopped. But the scroll event not triggered on older version Chrome (like v89) in this case.
What is expected?
The scrolling should be stopped when the target li reaches top and no longer sets the scrollTop of ul.
What is actually happening?
The scrolling is not stopped and keeping setting the scrollTop to the same value, which will have side effect on my component.
Environment
Info
antd
5.15.1
React
16.8
System
Windows 11
Browser
Chrome 124
I tried to changed the termimal condition as below, the scrolling is stopped and can be scrolled manually again:
@MadCcc Sure. After selecting a time, the target time will scroll to top, then the scroll will never stop. (I pressed F8 to continue debug, the break points never stopped)
Reproduction link
https://stackblitz.com/edit/react-gbhomy?file=demo.tsx
Steps to reproduce
For rc-picker used by TimePicker, I found the code below in useScrollTo.ts seemed to be buggy. After selecting a time from the time panel, the panel ul will scroll to the target li position. But when the target li is reaching top, the scrolling is not stopped, causing the scroll event could not be triggered on mouse-wheel scrolling.
When the scenario above happens, the
scrollDistRef.current
is always equal todist
. So the stopScroll will be never called.As I observed, on the latest Chrome, the scroll event can be fired even if the scrolling is not stopped. But the scroll event not triggered on older version Chrome (like v89) in this case.
What is expected?
The scrolling should be stopped when the target li reaches top and no longer sets the
scrollTop
of ul.What is actually happening?
The scrolling is not stopped and keeping setting the
scrollTop
to the same value, which will have side effect on my component.I tried to changed the termimal condition as below, the scrolling is stopped and can be scrolled manually again:
That is, to stop scrolling when
scrollDistRef
anddist
is equal (dist does not change anymore).The text was updated successfully, but these errors were encountered: