aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-08-02 01:59:20 +0800
committerGitHub <noreply@github.com>2017-08-02 01:59:20 +0800
commit947f13d58c6a6341c42728cb1113b09cb0765de9 (patch)
tree9ba21e96e2d440aa1def0e95cfdfaaf4b6eea55c
parent651fec5112ee77eed995db80621d2ae6e799e8cf (diff)
parent4044b58b5a7133caeefd0f3c0a16478387fe7247 (diff)
downloadtangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar.gz
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar.bz2
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar.lz
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar.xz
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.tar.zst
tangerine-wallet-browser-947f13d58c6a6341c42728cb1113b09cb0765de9.zip
Merge pull request #1841 from sdtsui/fix/dropdown-toggle
[Part-1] Fix/dropdown toggle
-rw-r--r--ui/app/app.js18
-rw-r--r--ui/app/components/account-dropdowns.js18
2 files changed, 32 insertions, 4 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index b251baefd..8fad0f7d6 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -198,7 +198,17 @@ App.prototype.renderNetworkDropdown = function () {
return h(Dropdown, {
isOpen,
onClickOutside: (event) => {
- this.setState({ isNetworkMenuOpen: !isOpen })
+ const { classList } = event.target
+ const isNotToggleElement = [
+ classList.contains('menu-icon'),
+ classList.contains('network-name'),
+ classList.contains('network-indicator'),
+ ].filter(bool => bool).length === 0;
+ // classes from three constituent nodes of the toggle element
+
+ if (isNotToggleElement) {
+ this.setState({ isNetworkMenuOpen: false })
+ }
},
zIndex: 11,
style: {
@@ -308,7 +318,11 @@ App.prototype.renderDropdown = function () {
isOpen: isOpen,
zIndex: 11,
onClickOutside: (event) => {
- this.setState({ isMainMenuOpen: !isOpen })
+ const { classList } = event.target
+ const isNotToggleElement = !classList.contains('sandwich-expando')
+ if (isNotToggleElement) {
+ this.setState({ isMainMenuOpen: false })
+ }
},
style: {
position: 'absolute',
diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js
index 61f32f713..2813f4752 100644
--- a/ui/app/components/account-dropdowns.js
+++ b/ui/app/components/account-dropdowns.js
@@ -17,6 +17,8 @@ class AccountDropdowns extends Component {
accountSelectorActive: false,
optionsMenuActive: false,
}
+ this.accountSelectorToggleClassName = 'fa-angle-down';
+ this.optionsMenuToggleClassName = 'fa-ellipsis-h';
}
renderAccounts () {
@@ -63,7 +65,13 @@ class AccountDropdowns extends Component {
maxHeight: '300px',
},
isOpen: accountSelectorActive,
- onClickOutside: () => { this.setState({ accountSelectorActive: false }) },
+ onClickOutside: (event) => {
+ const { classList } = event.target
+ const isNotToggleElement = !classList.contains(this.accountSelectorToggleClassName)
+ if (accountSelectorActive && isNotToggleElement) {
+ this.setState({ accountSelectorActive: false })
+ }
+ },
},
[
...this.renderAccounts(),
@@ -115,7 +123,13 @@ class AccountDropdowns extends Component {
minWidth: '180px',
},
isOpen: optionsMenuActive,
- onClickOutside: () => { this.setState({ optionsMenuActive: false }) },
+ onClickOutside: () => {
+ const { classList } = event.target
+ const isNotToggleElement = !classList.contains(this.optionsMenuToggleClassName)
+ if (optionsMenuActive && isNotToggleElement) {
+ this.setState({ optionsMenuActive: false })
+ }
+ },
},
[
h(