Skip to content

Commit

Permalink
Fix OuiPopover does not change position on the scroll (opensearch-pro…
Browse files Browse the repository at this point in the history
…ject#1184)

Signed-off-by: Vladimir Komolov <[email protected]>
Signed-off-by: Комолов Владимир <[email protected]>
  • Loading branch information
Vladimir Komolov authored and Комолов Владимир committed Mar 6, 2024
1 parent 543435a commit 4c7aca2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- Prevent action buttons of OuiDataGridCell from moving the content ([#1224](https://github.com/opensearch-project/oui/pull/1224))
- Fix vertical alignment and font weight of breadcrumbs that are buttons or links ([#1232](https://github.com/opensearch-project/oui/pull/1232))
- Fix datagrid lines ([#1250](https://github.com/opensearch-project/oui/pull/1250))
- Fix OuiPopover does not change position on the scroll ([#1184](https://github.com/opensearch-project/oui/pull/1184))

### 🚞 Infrastructure

Expand Down
8 changes: 4 additions & 4 deletions src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export class OuiPopover extends Component<Props, State> {
}

if (this.props.repositionOnScroll) {
window.addEventListener('scroll', this.positionPopoverFixed);
window.addEventListener('scroll', this.positionPopoverFixed, true);
}
}

Expand All @@ -545,9 +545,9 @@ export class OuiPopover extends Component<Props, State> {
// update scroll listener
if (prevProps.repositionOnScroll !== this.props.repositionOnScroll) {
if (this.props.repositionOnScroll) {
window.addEventListener('scroll', this.positionPopoverFixed);
window.addEventListener('scroll', this.positionPopoverFixed, true);
} else {
window.removeEventListener('scroll', this.positionPopoverFixed);
window.removeEventListener('scroll', this.positionPopoverFixed, true);
}
}

Expand All @@ -565,7 +565,7 @@ export class OuiPopover extends Component<Props, State> {
}

componentWillUnmount() {
window.removeEventListener('scroll', this.positionPopoverFixed);
window.removeEventListener('scroll', this.positionPopoverFixed, true);
clearTimeout(this.respositionTimeout);
clearTimeout(this.closingTransitionTimeout);
cancelAnimationFrame(this.closingTransitionAnimationFrame!);
Expand Down

0 comments on commit 4c7aca2

Please sign in to comment.