File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,16 @@ const ItemRender = props => {
4040 < MenuItemRenderer { ...props }
4141 onClick = { event => {
4242 // Call the action and close the menu
43- onClick ( props , event ) ;
44- event . stopPropagation ( ) ;
45- rootMenuContext . dispatch ( { type : 'close' } ) ;
43+ if ( onClick ) {
44+ onClick ( props , event ) ;
45+ event . stopPropagation ( ) ;
46+ rootMenuContext . dispatch ( { type : 'close' } ) ;
47+ }
4648 } }
4749 onMouseEnter = { event => {
4850 if ( menuContext ) {
4951 // Open submenu (only if it's not opened already)
50- if ( ! menuState . isOpen ) {
52+ if ( menuState && ! menuState . isOpen ) {
5153 const c = event . currentTarget . getBoundingClientRect ( ) ;
5254 menuContext . display ( null , {
5355 anchorEl : {
@@ -80,8 +82,8 @@ ItemRender.propTypes = {
8082 rootMenuContext : PropTypes . object ,
8183 parentMenuContext : PropTypes . object ,
8284 menuContext : PropTypes . object ,
83- menuState : PropTypes . object . isRequired ,
84- onClick : PropTypes . func . isRequired ,
85+ menuState : PropTypes . object ,
86+ onClick : PropTypes . func ,
8587 isVisible : PropTypes . bool
8688} ;
8789
You can’t perform that action at this time.
0 commit comments