feat(cdk/scrolling): Scroll functions silently fail if the viewport is not yet fully initialized #23716
Labels
area: cdk/scrolling
feature
This issue represents a new feature or feature request rather than a bug or bug fix
P4
A relatively minor issue that is not relevant to core functions
Feature Description
cdk-virtual-scroll-viewport
'sscrollTo...
functions (likescrollToIndex
) silently fail when the viewport is not yet initialized. Technically the functions are doing nothing wrong from a code standpoint, but since the component is not yet fully initialized, it is empty, so trying to scroll will do nothing meaningful. Sending back an error (or at least logging a warning to the console) if an empty viewport is scrolled would be helpful so that developers know that something went wrong.This would be mitigated if we had an async option that managed the timing of scroll commands. See this feature request.
Use Case
This would improve every use case of the virtual scroller.
The text was updated successfully, but these errors were encountered: