Material-ui: [IconMenu] Suggestion: onRequestChange

Created on 14 Dec 2016  路  4Comments  路  Source: mui-org/material-ui

Would you guys be open to a PR to make onRequestChange work without needing to supply the prop open to the component? Since open is also in the components state. This might apply to other menus as well. Thanks for the great library

Most helpful comment

@lucasbento thanks for the reply.

It was mainly dealing with the onRequestChange, and not knowing it wasn't working because someone didn't supply open props to the IconMenu component. Was hoping it would be more clear to users in the future unless it was noted in the documentation. Seemed like a low hanging enhancement that would allow an easier usage.

Also, I'd be happy to contribute, especially to a library I'm using professionally. Do you have any links or docs, or would I just start opening PRs for review.

All 4 comments

Hey @danieljoonlee, I guess it could work that way since we only use the open prop to identify if the component is opened or not when it initialises.

Although, I would like to know the case that makes you need to use onRequestChange but can't supply the open prop, is there an issue behind it or you are looking into improving the code?

By the way, we are strongly focusing on the next release and only working on bugs on the current version, we would love your help there too. 馃槈

@lucasbento thanks for the reply.

It was mainly dealing with the onRequestChange, and not knowing it wasn't working because someone didn't supply open props to the IconMenu component. Was hoping it would be more clear to users in the future unless it was noted in the documentation. Seemed like a low hanging enhancement that would allow an easier usage.

Also, I'd be happy to contribute, especially to a library I'm using professionally. Do you have any links or docs, or would I just start opening PRs for review.

@danieljoonlee: yeah, you can check out our contributing page and roadmap.

We would definitely like some help on next release.

Thanks for your interest, by the way!

We have been removing the IconMenu component on the v1-beta branch. We are now encouraging people to use lower level components: the IconButton and Menu component:

juil -29-2017 19-54-51

  return (
      <div>
        <IconButton
          aria-label="More"
          aria-owns="long-menu"
          aria-haspopup="true"
          onClick={this.handleClick}
        >
          <MoreVertIcon />
        </IconButton>
        <Menu
          id="long-menu"
          anchorEl={this.state.anchorEl}
          open={this.state.open}
          onRequestClose={this.handleRequestClose}
          style={{ maxHeight: ITEM_HEIGHT * 4.5 }}
          MenuListProps={{
            style: {
              width: 200,
            },
          }}
        >
          {options.map(option =>
            <MenuItem key={option} selected={option === 'Pyxis'} onClick={this.handleRequestClose}>
              {option}
            </MenuItem>,
          )}
        </Menu>
      </div>
    );

Hence, I'm closing it. Still, we will accept PR fixes until v1-beta takes over the master branch.

Was this page helpful?
0 / 5 - 0 ratings