fix: 修复 table 获取滚动的父元素不准确的问题 (#5329)

This commit is contained in:
meerkat 2022-09-15 15:18:18 +08:00 committed by GitHub
parent a02f2a3d81
commit 227e77fab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -630,25 +630,7 @@ export default class Table extends React.Component<TableProps, object> {
componentDidMount() {
const currentNode = findDOMNode(this) as HTMLElement;
// 获取小于所有子元素高度之和的父元素
let parent: HTMLElement | Window | null = getScrollParent(
currentNode,
parent => {
if (parent.getAttribute('role') === 'dialog') {
/**
*
* * Dialog ,
* ! dialog
* TODO
*/
return true;
}
// * 具备 overflow-*:auto 的父元素的高度小于当前元素
return (
parent.offsetHeight > 0 && parent.offsetHeight < parent.scrollHeight
);
}
);
let parent: HTMLElement | Window | null = getScrollParent(currentNode);
if (!parent || parent === document.body) {
parent = window;