Skip to content

Conversation

ccqgithub
Copy link

现在,Dropdown有一个bug,如果触发滚动的元素在一个可以滚动的div内,div滚动时dropdown的位置不会更新。
虽然现在有一个getPopupContainer的属性,但是这个属性局限性很大,比如有下面两个问题:
一:zIndex的问题,如果dropdown的popup在div内,有时候会被遮挡。
二:多层滚动嵌套时。

解决方法:监听所有的滚动事件, 只要是trgger的父元素滚动,就重新定位。
这里使用事件捕获而不是事件冒泡,因为滚动事件不会冒泡到根元素。

现在,Dropdown有一个bug,如果触发滚动的元素在一个可以滚动的div内,div滚动时dropdown的位置不会更新。
虽然现在有一个getPopupContainer的属性,但是这个属性局限性很大,比如有下面两个问题:
一:zIndex的问题,如果dropdown的popup在div内,有时候会被遮挡。
二:多层滚动嵌套时。

解决方法:监听所有的滚动事件, 只要是trgger的父元素滚动,就重新定位。
这里使用事件捕获而不是事件冒泡,因为滚动事件不会冒泡到根元素。
@codecov
Copy link

codecov bot commented Jun 22, 2021

Codecov Report

Merging #126 (7049848) into master (868712e) will decrease coverage by 1.76%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #126      +/-   ##
==========================================
- Coverage   96.89%   95.13%   -1.77%     
==========================================
  Files           3        3              
  Lines         129      144      +15     
  Branches       31       35       +4     
==========================================
+ Hits          125      137      +12     
- Misses          4        7       +3     
Impacted Files Coverage Δ
src/Align.tsx 95.60% <80.00%> (-3.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 868712e...7049848. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant