From 85d17b607ed8af8f0de60baa77983935b2cf0b36 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 21 Mar 2019 15:35:34 -0400 Subject: [PATCH] fix: remove event listener when leaving file page --- src/ui/component/fileViewer/internal/player.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/component/fileViewer/internal/player.jsx b/src/ui/component/fileViewer/internal/player.jsx index 0f03ad559..0cb98774a 100644 --- a/src/ui/component/fileViewer/internal/player.jsx +++ b/src/ui/component/fileViewer/internal/player.jsx @@ -90,6 +90,9 @@ class MediaPlayer extends React.PureComponent { componentWillUnmount() { const mediaElement = this.mediaContainer.current.children[0]; + + document.removeEventListener('keydown', this.togglePlay); + if (mediaElement) { mediaElement.removeEventListener('click', this.togglePlay); }