From cb65ed446f0ef5f77422a521ee013ecd8622aeb5 Mon Sep 17 00:00:00 2001 From: controlol Date: Wed, 3 Nov 2021 20:40:14 +0100 Subject: [PATCH] disable clicks when a menu is opened --- src/components/fileBrowser.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/fileBrowser.jsx b/src/components/fileBrowser.jsx index f639f1f..f81e4f5 100644 --- a/src/components/fileBrowser.jsx +++ b/src/components/fileBrowser.jsx @@ -254,6 +254,8 @@ class FileBrowser extends Component { // change the way files should be ordered updateOrder = orderBy => { + if (this.props.menuOpen || this.state.showMenu) return; + if (this.state.orderBy === orderBy) { this.setState({ orderAscending: !this.state.orderAscending }) } else { @@ -299,7 +301,7 @@ class FileBrowser extends Component { // after the user clicks on a folder updatePath = (isDir, name) => { - if (isDir) { + if (isDir && !(this.props.menuOpen || this.state.showMenu)) { const newPath = path.join(this.props.currentPath, name) this.props.updateFiles(newPath) @@ -309,6 +311,8 @@ class FileBrowser extends Component { // after the user clicks on the back button previousDirectory = () => { + if (this.props.menuOpen || this.state.showMenu) return; + let currentPath = this.props.currentPath.split("/") currentPath.pop() @@ -318,12 +322,16 @@ class FileBrowser extends Component { // after the user click on the home button rootDirectory = () => { + if (this.props.menuOpen || this.state.showMenu) return; + this.props.updateFiles("/") this.setState({filter: ""}) } // after the user clicks on a path piece goToPath = index => { + if (this.props.menuOpen || this.state.showMenu) return; + let currentPath = this.props.currentPath.split("/") if (index !== currentPath.length - 2) {