mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix dropdown toggle behavior - account dropdowns
This commit is contained in:
parent
651fec5112
commit
24d375aaf1
@ -17,6 +17,8 @@ class AccountDropdowns extends Component {
|
|||||||
accountSelectorActive: false,
|
accountSelectorActive: false,
|
||||||
optionsMenuActive: false,
|
optionsMenuActive: false,
|
||||||
}
|
}
|
||||||
|
this.accountSelectorToggleClassName = 'fa-angle-down';
|
||||||
|
this.optionsMenuToggleClassName = 'fa-ellipsis-h';
|
||||||
}
|
}
|
||||||
|
|
||||||
renderAccounts () {
|
renderAccounts () {
|
||||||
@ -63,7 +65,13 @@ class AccountDropdowns extends Component {
|
|||||||
maxHeight: '300px',
|
maxHeight: '300px',
|
||||||
},
|
},
|
||||||
isOpen: accountSelectorActive,
|
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(),
|
...this.renderAccounts(),
|
||||||
@ -115,7 +123,13 @@ class AccountDropdowns extends Component {
|
|||||||
minWidth: '180px',
|
minWidth: '180px',
|
||||||
},
|
},
|
||||||
isOpen: optionsMenuActive,
|
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(
|
h(
|
||||||
|
Loading…
Reference in New Issue
Block a user