-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IconMenu] Set container as anchorEl when using prop 'open' #3666
Conversation
if (nextProps.open !== null) { | ||
this.setState({ | ||
open: nextProps.open, | ||
anchorEl: ReactDOM.findDOMNode(this.refs.iconMenuContainer), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findDOMNode
is not needed as the target is a dom element. Ideally, it would be even better if you could use callback refs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alitaheri!, I removed findDOMNode
.
Thanks for finding this bug 👍 👍 |
c12e754
to
796009c
Compare
Thanks a lot 👍 @callemall/material-ui Looking good 😁 |
Looks good here too, but I notice that the 'Controlled examples' aren't truly controlled - only the selected value(s) for which there's no internal state anyway. @alitaheri - would it make sense to update the controlled examples so the |
@mbrookes Hmmm, I guess that's why we didn't notice this bug in the first place O.o Good catch 👍 @crashbell Would that be ok to add an example for this to prevent future regressions? that would be appreciated, thanks a lot 👍 👍 :grin |
Let me try to update the docs. Thanks for reviewing this PR. |
While making the sample I found out that this issue was handled in this code but I don't know why Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null It's working properly with the docs code. |
I found out the root cause here: #3647 |
@crashbell Thanks for getting to the bottom of it 👍 We'll release another alpha soon 😁 |
796009c
to
9f901cd
Compare
9f901cd
to
3c77dba
Compare
This is looking really good, thanks a lot for tackling this 👍 @callemall/material-ui Take a look. |
[IconMenu] Set container as anchorEl when using prop 'open'
@crashbell Probably this week, have a look at #3700. |
@crashbell In any case you don't need to monkey patch - just use HEAD@3c77dba97. 👍 |
thanks @oliviertassinari and @mbrookes so much! |
IconMenu allows to use prop
open
to open the popover but theanchorEl
isn't set at the first load so this causes a wrong position.