New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select、TimePicker等组件在非body出现滚动条时,滚动时位置有bug #3487
Comments
getPopupContainer |
多谢 |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
@afc163 I was used component more than 300 places in App. I wanted to fix and implement the recommended code for the scrolling issue to update all the places in my app like below; <Select getPopupContainer={trigger => trigger.parentNode}> so, it's very hard to implement for all code editing. It's possible to fix it from single place with out updating all the component places. in my app |
问题描述
select、TimePicker等组件,当放置到某节点,并且这个节点有滚动条时,当这个节点滚动时,弹出的option层、日历选择层等停留在原有位置,不跟随滚动。这个问题还是挺常见的,比如将这类控件放到Modal里、放到Table里等(放入的这些控件自己设置了overflow:auto)。
问题原因
弹出的层放到了和初始展示节点不同的节点中,导致了弹出层是相对于body进行绝对定位,而当初始展示节点在一个带滚动条的节点时,这个节点在滚动时,body并没有变化,就造成了弹出层不随浏览器滚动的问题。这个应该是rc-select等底层组件的bug。
示例
打开 TimePicker官方API在控制台将
.code-box
的样式增加在任意一个例子中点击组件弹出日历弹出层,然后滚动那个节点的滚动条
建议解决方式
将弹出的层放到了和初始展示节点放到同一个父节点中,弹出层相对于这个父节点进行绝对定位。
The text was updated successfully, but these errors were encountered: