What is the need to use Portal for the likes of Select components #2695
-
From the docs of Select (and similar components that have any kind of popover -
Im wondering what the need is for using Portals here? The reason I ask, im trialling out using Zag-js for a custom multi-select, and im using the docs and source code from Ark-UI as a guide, but have never came across the need to use Portals for components like this that has a popover, other than just applying relative positioning to the popover (which I assume is handled by the Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Portals are helpful for breaking out of the DOM hierarchy so that your component isn't affected by nearby parent elements. The |
Beta Was this translation helpful? Give feedback.
Portals are helpful for breaking out of the DOM hierarchy so that your component isn't affected by nearby parent elements.
The
Select.Positioner
hasposition: absolute
set on it, making it susceptible to issues when a parent element hasposition: relative.
Portals are generally optional but recommended.