Skip to content

Commit bf11b90

Browse files
fixes #297
1 parent e8299a0 commit bf11b90

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ContextMenu.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ export default class ContextMenu extends AbstractMenu {
5959
}
6060

6161
componentDidUpdate() {
62+
const wrapper = window.requestAnimationFrame || setTimeout;
6263
if (this.state.isVisible) {
63-
const wrapper = window.requestAnimationFrame || setTimeout;
64-
6564
wrapper(() => {
6665
const { x, y } = this.state;
6766

@@ -78,9 +77,11 @@ export default class ContextMenu extends AbstractMenu {
7877
});
7978
});
8079
} else {
81-
if (!this.menu || !this.state.isVisible) return;
82-
this.menu.style.opacity = 0;
83-
this.menu.style.pointerEvents = 'none';
80+
wrapper(() => {
81+
if (!this.menu) return;
82+
this.menu.style.opacity = 0;
83+
this.menu.style.pointerEvents = 'none';
84+
});
8485
}
8586
}
8687

0 commit comments

Comments
 (0)