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

calculatePosition is called to measure content dimensions before the content is in the wormhole #443

Open
DingoEatingFuzz opened this issue Jan 19, 2019 · 0 comments

Comments

@DingoEatingFuzz
Copy link

What happened

This is best explained with a couple screenshots.

image

The moment reposition, and subsequently calculatePosition is called, the content component is still a sibling of the dropdown trigger. The consequence in this case is a scrunched width due to the content component being in a flexbox wrapper and having labels that lend itself well to linebreaks. This results in a very tall element (269px).

image

The dimensions of the content component in this intermediate state are then used to compute the final top inline style, but as you can see in the second screenshot, now that the content component is in the wormhole, text doesn't wrap and the content component is half the original height (125px). So the top positioning is off by 144px.

What I expected to happen

The dimensions of the content component should be calculated based on its final position in the DOM. This would correctly position the dropdown above the trigger.

Suggestion on how to fix this

Hopefully fixing this is a simple matter of slapping a schedule.once('afterRender', ...) somewhere? I didn't read through the source too much, but I saw enough to know that there's a lot of nuance 😄

Workarounds for the time being

If anyone else is running into funky offsets, be mindful of your styles in different contexts. Watch out for cascading margins and paddings, and maybe use a white-space: nowrap to be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant