-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Conversation
…created correctly, after [RenderToLayer] has completed it's render
…r layout to be setup correctly). Also fixed [Menu] tests to work with recent onTouchTap -> onClick changes.
src/Popover/Popover.js
Outdated
this.state = { | ||
open: props.open, | ||
closing: false, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
this.setPlacement(); | ||
setTimeout(this.setPlacement, 1); |
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.
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.
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.
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.
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. |
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 :). |
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. |
@lostpebble Thanks |
@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. |
@lostpebble Which components do you miss from the v1-beta branch? Could you 👍 on the issues you want to see first? |
Sure, will do that. It's pretty much just |
@lostpebble We will release v1 before migrating the DatePicker, we miss some documentation for the Drawer and to finish #6878. The |
A continuation of issue #7605
Something has changed in React Fiber which might have something to do with
unstable_renderSubtreeIntoContainer
whichPopOver
(andRenderToLayer
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