When I use a few icon menus than box-shadow looks very dark. How to fix that?1: enter image description here

Codesandbox example https://codesandbox.io/embed/flamboyant-tdd-r83u1

 <div>{items.map((item, index) => {return (<Fragment key={index}><IconButtonaria-owns={open ? "long-menu" : undefined}onClick={this.handleClick}><MoreVertIcon /></IconButton><Menu anchorEl={anchorEl} open={open} onClose={this.handleClose}>{options.map(option => (<MenuItem key={option} onClick={this.handleClose}>{option}</MenuItem>))}</Menu></Fragment>);})}</div>
2

Best Answer


Because, actually you are triggering multiple menus with the same flag at the same time. So shadow is dark because there are multiple menus one after the other.

Below code should fix this, You don't have to render Menu in items loop

 render() {const items = [...Array(10).keys()];const { anchorEl } = this.state;const open = Boolean(anchorEl);return (<div>{items.map((item, index) => {return (<Fragment key={index}><IconButtonaria-owns={open ? "long-menu" : undefined}onClick={this.handleClick}><MoreVertIcon /></IconButton></Fragment>);})}<Menu anchorEl={anchorEl} open={open} onClose={this.handleClose}>{options.map(option => (<MenuItem key={option} onClick={this.handleClose}>{option}</MenuItem>))}</Menu></div>);}