diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/src/PivotTableUI.jsx b/src/PivotTableUI.jsx index 0cb94f8..fd4acdf 100644 --- a/src/PivotTableUI.jsx +++ b/src/PivotTableUI.jsx @@ -137,12 +137,14 @@ export class DraggableAttribute extends React.Component { } toggleFilterBox(event) { - const bodyRect = document.body.getBoundingClientRect(); + const relativeRect = document + .querySelector('.pvtUi') + .getBoundingClientRect(); const rect = event.nativeEvent.target.getBoundingClientRect(); this.setState({ open: !this.state.open, - top: 10 + rect.top - bodyRect.top, - left: 10 + rect.left - bodyRect.left, + top: 10 + rect.top - relativeRect.top, + left: 10 + rect.left - relativeRect.left, }); this.props.moveFilterBoxToTop(this.props.name); } diff --git a/src/pivottable.css b/src/pivottable.css index e7b868f..068f9e0 100644 --- a/src/pivottable.css +++ b/src/pivottable.css @@ -2,6 +2,7 @@ color: #2a3f5f; font-family: Verdana; border-collapse: collapse; + position: relative; } .pvtUi select { user-select: none;