Skip to content

Commit 4c7aca2

Browse files
Vladimir KomolovКомолов Владимир
Vladimir Komolov
authored and
Комолов Владимир
committed
Fix OuiPopover does not change position on the scroll (#1184)
Signed-off-by: Vladimir Komolov <[email protected]> Signed-off-by: Комолов Владимир <[email protected]>
1 parent 543435a commit 4c7aca2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- Prevent action buttons of OuiDataGridCell from moving the content ([#1224](https://github.com/opensearch-project/oui/pull/1224))
4141
- Fix vertical alignment and font weight of breadcrumbs that are buttons or links ([#1232](https://github.com/opensearch-project/oui/pull/1232))
4242
- Fix datagrid lines ([#1250](https://github.com/opensearch-project/oui/pull/1250))
43+
- Fix OuiPopover does not change position on the scroll ([#1184](https://github.com/opensearch-project/oui/pull/1184))
4344

4445
### 🚞 Infrastructure
4546

src/components/popover/popover.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ export class OuiPopover extends Component<Props, State> {
532532
}
533533

534534
if (this.props.repositionOnScroll) {
535-
window.addEventListener('scroll', this.positionPopoverFixed);
535+
window.addEventListener('scroll', this.positionPopoverFixed, true);
536536
}
537537
}
538538

@@ -545,9 +545,9 @@ export class OuiPopover extends Component<Props, State> {
545545
// update scroll listener
546546
if (prevProps.repositionOnScroll !== this.props.repositionOnScroll) {
547547
if (this.props.repositionOnScroll) {
548-
window.addEventListener('scroll', this.positionPopoverFixed);
548+
window.addEventListener('scroll', this.positionPopoverFixed, true);
549549
} else {
550-
window.removeEventListener('scroll', this.positionPopoverFixed);
550+
window.removeEventListener('scroll', this.positionPopoverFixed, true);
551551
}
552552
}
553553

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

567567
componentWillUnmount() {
568-
window.removeEventListener('scroll', this.positionPopoverFixed);
568+
window.removeEventListener('scroll', this.positionPopoverFixed, true);
569569
clearTimeout(this.respositionTimeout);
570570
clearTimeout(this.closingTransitionTimeout);
571571
cancelAnimationFrame(this.closingTransitionAnimationFrame!);

0 commit comments

Comments
 (0)