[Feature Request] Collapse 支持当前被展开项目在动画结束前都保持在视口内
luwuer opened this issue · comments
What problem does this feature solve?
问题:Collapse 设置 accordion 属性,当展开内容有一定高度时,下一个展开项目在展开时可能因为滚动条变化而看不见任何内容,需要手动移动滚动条才能看到展开内容。
问题展示,视频(新展开项目 ——标题 1 ,消失在视口):
2024-04-12.15.41.28.mov
预期实现:
2024-04-12.15.55.30.mov
补充说明:
- 由于滚动机制优化差异,在 Safari 上这个问题严重得多。核心差异在于折叠内容在 Chrome 上不可见时,视图内的节点不会有位置变化,而 Safari 上原原本本的反应折叠内容的高度丢失,从而当前展开内容会因为上方内容高度丢失过多而完全消失在视口内。
What does the proposed API look like?
CollapseItem 新增属性 expandInViewport ,默认 false,设置为 true 时表示展开内容需要呆在视口内,不会因为折叠项高度消失导致展开内容被滚动到视口外。
<van-collapse accordion>
<van-collapse-item expand-in-viewport></van-collapse-item>
</van-collapse>
确认接纳这个功能后,我可以提供 PR 实现相应逻辑(Vue2、Vue3)
Hello @luwuer. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to main
branch, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
你好 @luwuer,我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到 main
分支,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待你的贡献。
如果实现不复杂的话,可以提供一个 props 来支持,欢迎 PR~
如果实现不复杂的话,可以提供一个 props 来支持,欢迎 PR~
test 目录下的快照文件是 CI 自动更新的吗?
遇到了同样的问题,下个版本会更新解决吗