diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-11-20 11:07:28 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-11-23 15:38:23 +0100 |
| commit | 78a44ff427c5277b13ec2c19171dc4d20ccbca0e (patch) | |
| tree | 3d59bcae158b3bb8431c9a38e8398f3d656e3a45 /gui/src | |
| parent | 3a78f67b38eaedcaee223dbd2f24eaec986e69b2 (diff) | |
| download | mullvadvpn-78a44ff427c5277b13ec2c19171dc4d20ccbca0e.tar.xz mullvadvpn-78a44ff427c5277b13ec2c19171dc4d20ccbca0e.zip | |
Make sure accordion onTransitionEnd is from correct transition
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/renderer/components/Accordion.tsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gui/src/renderer/components/Accordion.tsx b/gui/src/renderer/components/Accordion.tsx index a9b07a7493..87dfdede24 100644 --- a/gui/src/renderer/components/Accordion.tsx +++ b/gui/src/renderer/components/Accordion.tsx @@ -104,11 +104,13 @@ export default class Accordion extends React.Component<IProps, IState> { } } - private onTransitionEnd = () => { - this.props.onTransitionEnd?.(); - if (this.props.expanded) { - // Height auto enables the container to grow if the content changes size - this.setState({ containerHeight: 'auto' }); + private onTransitionEnd = (event: React.TransitionEvent<HTMLDivElement>) => { + if (event.target === this.containerRef.current) { + this.props.onTransitionEnd?.(); + if (this.props.expanded) { + // Height auto enables the container to grow if the content changes size + this.setState({ containerHeight: 'auto' }); + } } }; } |
