OverlayPanel and Menu positioning problem #4524
Replies: 1 comment
-
|
Good analysis — your understanding of the positioning logic is correct. In PrimeReact,
Because of that, That said, you’re also right that this creates friction when consumers explicitly want the overlay positioned relative to its actual DOM context. Components like From my perspective, the original choice was about safety and consistency, not because alignOverlay was unsuitable. With more components now supporting flexible append targets, revisiting this — or conditionally switching behavior based on Personally, I think this is less about a bug and more about an evolving design tradeoff, and your suggestion makes sense as a potential refinement rather than a breaking change. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
This is a followup discussion to this issue: primefaces/primereact#6351
After a research, I think that the problem is related to how the
topandleftcoordinates are being calculated in bothMenuandOverlayPanelcomponents. In both cases, the utility function used isDomHandler.positionAbsolutethat always takes into considerationviewportand ignores theappendToprop that might signal the component that the consumer wants to place the element where it is actually rendered in the VDOM (passing self as value).I was thinking that a solution might be to use
DomHandler.alingOverlay, the same as forMultiSelectcomponent, in this way thetopandleftcoordinates will be correctly computed.My question would be: was there any intention in using
positionAbsoluterather thanalignOverlayin the first place?Existing code snippet for aligning overlay in Menu component
Existing code snippet for aligning overlay in OverlayPanel component
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions