align
align copied to clipboard
fix: 非根元素滚动时没有更新位置
现在,Dropdown有一个bug,如果触发滚动的元素在一个可以滚动的div内,div滚动时dropdown的位置不会更新。 虽然现在有一个getPopupContainer的属性,但是这个属性局限性很大,比如有下面两个问题: 一:zIndex的问题,如果dropdown的popup在div内,有时候会被遮挡。 二:多层滚动嵌套时。
解决方法:监听所有的滚动事件, 只要是trgger的父元素滚动,就重新定位。 这里使用事件捕获而不是事件冒泡,因为滚动事件不会冒泡到根元素。
Codecov Report
Merging #126 (7049848) into master (868712e) will decrease coverage by
1.76%. The diff coverage is80.00%.
@@ 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%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 868712e...7049848. Read the comment docs.