Android submenu support

This commit is contained in:
Chen-I Lim 2020-12-02 17:10:38 -08:00
parent a8801c0525
commit b9b1020748

View file

@ -30,6 +30,13 @@ export default class SubMenuOption extends React.PureComponent<SubMenuOptionProp
}, 50) }, 50)
} }
// The click handler is needed to support Android Chrome
private handleClick = (e: React.MouseEvent): void => {
e.preventDefault()
e.stopPropagation()
this.setState({isOpen: true})
}
private close = (): void => { private close = (): void => {
this.setState({isOpen: false}) this.setState({isOpen: false})
} }
@ -40,6 +47,7 @@ export default class SubMenuOption extends React.PureComponent<SubMenuOptionProp
className='MenuOption SubMenuOption menu-option' className='MenuOption SubMenuOption menu-option'
onMouseEnter={this.handleMouseEnter} onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.close} onMouseLeave={this.close}
onClick={this.handleClick}
> >
{this.props.icon ?? <div className='noicon'/>} {this.props.icon ?? <div className='noicon'/>}
<div className='menu-name'>{this.props.name}</div> <div className='menu-name'>{this.props.name}</div>