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

(dropdown): Update dropdownMenuContent to expose portal container prop #5189

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kmccrory-grx
Copy link

@kmccrory-grx kmccrory-grx commented Oct 2, 2024

the dropdownMenuContent includes the portal component, however we do not have access to the portal props, including container. if we want to portal our main menu to another element, we can not.

i think if the container includes the portal component, the portal props should be exposed, at least the container.

as it stands currently, shad exports the menuContent that includes the portal, as well as the menuportal component itself. it also points users to the radix documentation for proper use of the api. this is confusing because radix says to wrap your element in a portal component and provide the container prop.

the situation that i found myself in, was i tried wraping the menucontent with the menuportal that was provided. this did not work and it took me a very long time to figure out that content was already wrapped in a portal.

my specific use case for this change is on our doc site, all of our code exists within an element with a specific id and our tailwind classes are prefixed with that ID, so we need to portal the dropdown to exist within that element with that specific id.

i think the options here are,

• decouple menuportal from menucontent
• give access to portal props from menucontent

i would lean towards decoupling since that is how the api in the radix docs has it laid out

the content includes the portal component, however we do not have access to the portal props, including `container`.  if we want to portal our main menu to another element, we can not.  

i think if the container includes the portal component, the portal props should be exposed, at least the container.  

as it stands currently, shad exports the menuContent that includes the portal, as well as the menuportal component itself.  it also points users to the radix documentation for proper use of the api.  radix says to wrap your element in a portal component and provide the container prop.  

the confusing situation that i found myself in, was i tried wraping the menucontent with the menuportal that was provided.  this did not work and it took me a very long time to figure out that content was already wrapped in a portal. 

my specific use case for this change is on our doc site, all of our code exists within an element with a specific id and our tailwind classes are prefixed with that ID, so we need to portal the dropdown to exist within that element with that specific id.
Copy link

vercel bot commented Oct 2, 2024

@kmccrory-grx is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@kmccrory-grx kmccrory-grx changed the title Update dropdown Update dropdownMenuContent to expose portal container prop Oct 2, 2024
@kmccrory-grx kmccrory-grx changed the title Update dropdownMenuContent to expose portal container prop (dropdown): Update dropdownMenuContent to expose portal container prop Oct 2, 2024
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

Successfully merging this pull request may close these issues.

1 participant