angular / angular/components

feat(cdk/scrolling): Scroll functions silently fail if the viewport is not yet fully initialized

未关闭
#23,716 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/scrolling feature P4
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### Feature Description

`cdk-virtual-scroll-viewport`'s `scrollTo...` functions (like `scrollToIndex`) 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](https://github.com/angular/components/issues/23715).

#### Use Case

This would improve every use case of the virtual scroller.

贡献指南

打开贡献指南

调研方向

从 cdk-virtual-scroll-viewport 的 scrollTo... 入口点开始,检查初始化和空 viewport 是如何表示的。与维护者确认完成后的行为应该是错误还是控制台警告,然后添加有针对性的覆盖,表明初始化前滚动不再静默失败。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。