Material-ui: Menu not spreading vertical anchorOrigin property to Popover

Created on 9 Jul 2018  路  2Comments  路  Source: mui-org/material-ui

  • [x] This is a v1.x issue (v0.x is no longer maintained).
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior


The Menu component should spread the anchorOrigin properties to the Popover component to position the menu (docs)

Current Behavior


The Menu component spreads the horizontal anchorOrigin property to it's Popover component, but doesn't seem to spread the vertical.

Steps to Reproduce (for bugs)

https://codesandbox.io/s/my4wvnj2jy

  1. Set anchorOrigin to {vertical: "top",horizontal: "right"} (displays correctly)
  2. Recompile
  3. Change it to {vertical: "bottom", horizontal: "right"} (displays incorrectly)

Context

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | v1.3.1 |
| React | latest |
| browser | chrome OS Version 67.0.3396.99 (Official Build) (32-bit) |

Popover question

Most helpful comment

Thanks, @oliviertassinari! I should have taken a peek there.

    <Menu
      id="simple-menu"
      anchorEl={anchorEl}
      getContentAnchorEl={null}
      open={Boolean(anchorEl)}
      onClose={this.handleClose}
      anchorOrigin={this.state.origin}
    >
    ...
    </Menu>

...did the trick.

All 2 comments

@jamstooks Don't miss the warning in the console:

Warning: Material-UI: you can not change the default anchorOrigin.vertical value
when also providing the getContentAnchorEl property to the popover component.
Only use one of the two properties.
Set getContentAnchorEl to null or left anchorOrigin.vertical unchanged.

Thanks, @oliviertassinari! I should have taken a peek there.

    <Menu
      id="simple-menu"
      anchorEl={anchorEl}
      getContentAnchorEl={null}
      open={Boolean(anchorEl)}
      onClose={this.handleClose}
      anchorOrigin={this.state.origin}
    >
    ...
    </Menu>

...did the trick.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zabojad picture zabojad  路  3Comments

reflog picture reflog  路  3Comments

ghost picture ghost  路  3Comments

TimoRuetten picture TimoRuetten  路  3Comments

rbozan picture rbozan  路  3Comments