Skip to content
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

[Popover] Fixed bug where Popover renders relative to screen #7663

Merged
merged 8 commits into from
Aug 5, 2017

Conversation

lostpebble
Copy link

A continuation of issue #7605

Something has changed in React Fiber which might have something to do with unstable_renderSubtreeIntoContainer which PopOver (and RenderToLayer inside of it) uses to render itself inside a container which initiated the click / opening event.

It might also have something to do with mounting order, as PopOver tries to render itself inside of one of its child elements. To ensure that the child layer is created correctly before attempting to render, a timeout is set at 1ms inside PopOver's componentDidMount before rendering the PopOver inside the layer. It's a quick fix, but at least it works.

From what I can gather in my projects, this should be the last step in making pre-V1 compatible with React Fiber.

In this pull request as well: Changed the tests for [Menu] to be in line with the previous pull request #7624

  • PR has tests / docs demo, and is linted.
  • Commit and PR titles begin with [ComponentName], and are in imperative form: "[Component] Fix leaky abstraction".
  • Description explains the issue / use-case resolved, and auto-closes the related issue(s) (http://tr.im/vFqem).

this.state = {
open: props.open,
closing: false,
};
}

componentDidMount() {
this.setPlacement();
setTimeout(this.setPlacement, 1);
Copy link
Member

@oliviertassinari oliviertassinari Aug 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's hidden something, I would normally ask to look into it, we shouldn't have such code. But anyway, the master is no longer a priority. Also, that might lead to other potential edge cases.

Can we just clear the timeout when unmounting? Also, no need to set 1, 0 or no argument is enough.

Copy link
Author

@lostpebble lostpebble Aug 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool, I'll make those changes and do the clear on unmount. Just figured it would be over so quick that clearing it is irrelevant - but I guess these things all work on a much more micro scale.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 5, 2017

Something has changed in React Fiber

I confirm the behavior, I have noticed it to some time ago in the v1-beta branch. We ended-up using the new portal API.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 5, 2017

I'm not suggesting we do such, the fewer changes, the less likely we introduce a regression, the less time we have to spend on it, the better :).

@lostpebble
Copy link
Author

Yep not ideal code, but yea I'm just hoping to get the pre-v1 branch compatible before V1 catches up with some of the components. Even if it's slightly dirty.

@oliviertassinari
Copy link
Member

@lostpebble Thanks

@lostpebble lostpebble deleted the fix-popover-rv16 branch August 5, 2017 10:10
@lostpebble
Copy link
Author

lostpebble commented Aug 5, 2017

@oliviertassinari Happy to help out :)

Thanks for all your work on this project. Looking forward to V1! I'll see if I can find time to contribute a bit to that branch as well to get those components I need up to speed.

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 5, 2017

@lostpebble Which components do you miss from the v1-beta branch? Could you 👍 on the issues you want to see first?

@lostpebble
Copy link
Author

Sure, will do that. It's pretty much just DatePicker and SelectField I think, and probably Drawer but might be creating my own implementation of that for my project.

@oliviertassinari
Copy link
Member

@lostpebble We will release v1 before migrating the DatePicker, we miss some documentation for the Drawer and to finish #6878. The SelectField is by far the most requested component. I will try to work on it.

djbuckley added a commit to manchesergit/material-ui that referenced this pull request Aug 7, 2017
* call_em_all_-_master/master:
  [showcase] added showcase of 'HoopHubs.com' (mui#7677)
  [PopOver] Fixed bug where PopOver renders relative to screen rather than layout container in React Fiber (mui#7663)
@oliviertassinari oliviertassinari changed the title [PopOver] Fixed bug where PopOver renders relative to screen rather than layout container in React Fiber [Popover] Fixed bug where Popover renders relative to screen rather than layout container in React Fiber Aug 15, 2017
@oliviertassinari oliviertassinari added the component: Popover The React component. label Aug 15, 2017
@oliviertassinari oliviertassinari changed the title [Popover] Fixed bug where Popover renders relative to screen rather than layout container in React Fiber [Popover] Fixed bug where Popover renders relative to screen Aug 15, 2017
igorokb added a commit to igorokb/material-ui that referenced this pull request Sep 15, 2017
…rather than layout container in React Fiber (mui#7663)"

This reverts commit 8432807.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Popover The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants