react-spectrum
c9dcf67a - Fully scroll collection elements into view when keyboard navigating (#3899)

Commit
2 years ago
Fully scroll collection elements into view when keyboard navigating (#3899) * temporarily making storybook scrolling * initial progress with alternative scrollIntoView util * moving scroll into view logic into Virtualizer this is so we can guarentee it runs after the Virtualizer item scrolling behavior * scroll table into view if focusable child is out of view addresses case where focusedKey hasnt changed but focus is moving between focusable children in a cell * make standalone calendar scroll into view if cell is out of view also adjusts getScrollParent so it doesnt return the same element if that element happens to be scrollable as well. This was causing an infinite loop in the scrollIntoViewport logic when navigating in a calendar in a popover * fixing tabs tests * account for scroll container borders if the scroll container has borders, the scroll rect is shifted so we need to compensate in order to calculate the correct scrollTop/scrollLeft to bring the item just into view * cleanup rafs * adding scrolling decorator * remove extra line * addressing review comments * make scrollIntoView and scrollIntoViewport args consistent * fixing tests some unrelated tests break in strict mode, will fix in future PR * removing overrides * Fixing function descriptions * add overrides back in * delay scrollIntoViewport calls if popover hasnt positioned itself * fix virtualizer raf cleanup cleaning up the raf in the useEffect cleanup was too aggressive since it isnt guarneteed that a replacement raf is made if a non focusedKey dependedcy changed * forgot to clear scroll callbacks * (DNM) Use scrollview scrollend to determine when it is safe to scrollIntoViewport (#3943) * forgot to clear scroll callbacks * tie scroll delay to ScrollView scroll end * adjusting logic for determining if needs to scroll * debug setup * only track last queued scrollIntoViewport call no real need to track multiple queued scrollIntoViewport calls, ideally should only scroll to the latest focused target * moving scrollIntoViewport call into TableView if user provides a scrollToItem to virtualizer, make it their responsibility to know when to call scrollIntoViewport since they control when the item is actually scrolled into the view with respect to the virtualizer * cleanup * more cleanup * fix rendered too many hooks error * reset setDelayScrolling on popover unmount * get rid of global in favor of checking for overflow: hidden on document * apply overlay position on first render previously it took two renders to apply positioning to the overlay which meant we had to track when a overlay was fully positioned after the second render before calling scrollIntoView. This required a global which we dont want * update column header position early if need be this allows us to get rid of delayScrolling global since we ensure the column header scroll position is up to date before calling scrollIntoViewport * revert signature change of scrollIntoView * always sync column header scroll position
Author
Parents
Loading