NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

Affix固钉在滚动条消失时,固定状态没有改变 #6764

Closed AdvanceOrange closed 3 years ago

AdvanceOrange commented 3 years ago

Reproduction link

https://codesandbox.io/s/ng-zorro-antd-ivy-forked-hmeb3

Steps to reproduce

  1. 点击remove
  2. 弹出modal,点击确认,移除组件
  3. 页面已经无法滚动,但affix固定状态没有改变

What is expected?

修复,affix应该取消固定

What is actually happening?

Affix固钉在window高度发生改变,滚动条消失时,固定状态没有改变

Environment Info
ng-zorro-antd 11.2.0
Browser chrome
zorro-bot[bot] commented 3 years ago

Translation of this issue:

The Affix nail disappears when the scroll bar disappears, the fixed state has not changed

reproduction link

[https://codesandbox.io/S/ng-zorro-antd-ivy-forked-hmeb3](https://codesandbox.io/s/ng- zorro-antd-ivy-forked-hmeb3)

steps to reproduce

  1. Click Remove
  2. Pop back MODAL, click OK, remove the component
  3. The page has not been scrolled, the single Affix fixed state has not changed

What is expected?

Repair, Affix should cancel fixation

What is actually happens?

Affix solids change in the height of the WINDOW, when the scroll bar disappears, the fixed state has not changed

ENVIRONMENT INFO
Ng-Zorro-ANTD 11.2.0
Browser Chrome
wzhudev commented 3 years ago

@AdvanceOrange Hi there. I didn't see that the Affix component is used in your reproduction. Could you please check that?

AdvanceOrange commented 3 years ago

@AdvanceOrange你好。我没有看到您的复制中使用了 Affix 组件。你能检查一下吗? 好的,这是新的链接 https://codesandbox.io/s/ng-zorro-antd-ivy-forked-0sqox

xaclincoln commented 3 years ago

看了源码的实现方式,原因在于nzTarget内容的变化无法触发位置更新,是否可以考虑使用ResizeObserver(不支持IE11)监控document.body或nzTarget的高度变化,示例如下 const observer = new ResizeObserver(()=>{ this.updatePosition() }; //可以结合RXJS减少更新频率 observer.observe(document.body);

wzhudev commented 3 years ago

看了源码的实现方式,原因在于nzTarget内容的变化无法触发位置更新,是否可以考虑使用ResizeObserver(不支持IE11)监控document.body或nzTarget的高度变化,示例如下 const observer = new ResizeObserver(()=>{ this.updatePosition() }; //可以结合RXJS减少更新频率 observer.observe(document.body);

是的,欢迎提交 PR

zorro-bot[bot] commented 3 years ago

Hello @AdvanceOrange. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please fill the Pull Request Template here, provide documentation/test cases if needed and make sure CI passed, we will review it soon. Appreciate it advance and we are looking forward to your contribution!

你好 @AdvanceOrange, 我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请务必填写 Pull Request 内的预设模板,提供改动所需相应的测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献! giphy