diff options
author | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-04 09:35:10 +0800 |
---|---|---|
committer | sdtsui <szehungdanieltsui@gmail.com> | 2017-08-04 09:35:10 +0800 |
commit | 10d3a519c881763d4b79876bb1fde6c8243c3427 (patch) | |
tree | f891514b0fc08b011902b560e1c034565c6123df | |
parent | 4d6a289629fdfb404251386564720a3a586fe79a (diff) | |
download | tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar.gz tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar.bz2 tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar.lz tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar.xz tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.tar.zst tangerine-wallet-browser-10d3a519c881763d4b79876bb1fde6c8243c3427.zip |
De-dupe click handler for sandwich-expando
-rw-r--r-- | ui/app/app.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/app/app.js b/ui/app/app.js index bafc13d32..fda48f41d 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -193,15 +193,17 @@ App.prototype.renderAppBar = function () { // hamburger props.isUnlocked && h(SandwichExpando, { + className: 'sandwich-expando', width: 16, barHeight: 2, padding: 0, isOpen: state.isMainMenuOpen, color: 'rgb(247,146,30)', - onClick: (event) => { - event.preventDefault() + onClick: () => { event.stopPropagation() - this.setState({ isMainMenuOpen: !state.isMainMenuOpen }) + this.setState({ + isMainMenuOpen: !state.isMainMenuOpen, + }) }, }), ]), @@ -340,9 +342,13 @@ App.prototype.renderDropdown = function () { isOpen: isOpen, zIndex: 11, onClickOutside: (event) => { - const { classList } = event.target - const isNotToggleElement = !classList.contains('sandwich-expando') - if (isNotToggleElement) { + const classList = event.target.classList + const parentClassList = event.target.parentElement.classList + + const isToggleElement = classList.contains('sandwich-expando') || + parentClassList.contains('sandwich-expando') + + if (isOpen && !isToggleElement) { this.setState({ isMainMenuOpen: false }) } }, |