Wrong fixed menu positioning inside a containing block
See original GitHub issueWhen using the Select with menuPosition="fixed"
inside a parent that is a containing block (all fixed positioned children are positioned relative to it, which can be done using transform: "translate(0)"
for example on any of its parents), this causes wrong calculation for the left
positioning… is there a way to calculate the left position against some parent element?
CodeSandBox: https://codesandbox.io/s/react-select-forked-x7lb6?file=/example.js:515-541
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Fixed position but relative to container - Stack Overflow
However, the div is inside a centered container. When I use position:fixed it fixes the div relative to the browser window, such as...
Read more >Layout and the containing block - CSS: Cascading Style Sheets
If the position property is fixed , the containing block is established by the viewport (in the case of continuous media) or the...
Read more >CSS absolute and fixed positioning - W3C Wiki
Fixed positioning is really just a specialized form of absolute positioning; ... In this case the containing block is the nearest positioned ancestor....
Read more >Absolute, Relative, Fixed Positioning: How Do They Differ?
The concern with fixed positioning is that it can cause situations where the fixed element overlaps content such that is is inaccessible. The ......
Read more >Position | Webflow University
Every element has a static position by default, so the element will stick to the document flow. Elements with static positioning appear in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works when menu is positioned at fixed as well. And if we put other elements you can also see that the menu is not a part of the parent flow. Not too sure if this is what you meant tho
This appears to be resolved as the
transform
is causing the misalignment and if it is necessary for boundary purposes, then menuPortal will likely be the preferred method.I will close this, but if there are other concerns or objections, we can discuss further and reopen if necessary.