We recently replaced our own Popover component to be built on top of react-dropdown-menu instead of react-popover since the two are almost identical, but the DropdownMenu also supports Submenus which is definitely something we want.
The migration was essentially free since both of these components share the vast majority of functionality and props, with the exception of onOpenAutoFocus. It seems that controlling the focus might be a critical part of how the dropdown menu works, so instead I suspect it might be a better solution to add the same Sub component to the Popover package.
It's not great for my team to support, document, and maintain two separate components that have almost entirely the same functionality just for the ability to sometimes add sub menus, but because onOpenAutoFocus is controlled by the Dropdown Menu and not available as a prop, it doesn't work for all of our use cases.
Anyone who uses Popover. The functionality between the two is so similar that I find it confusing they're even separate components to begin with.
The dropdown menu doesn't quite feel like a primitive, considering it has higher order patterns like checkboxes and radio groups built into it which area already available as primitives.
Feature request
Overview
We recently replaced our own
Popover
component to be built on top ofreact-dropdown-menu
instead ofreact-popover
since the two are almost identical, but theDropdownMenu
also supports Submenus which is definitely something we want.The migration was essentially free since both of these components share the vast majority of functionality and props, with the exception of
onOpenAutoFocus
. It seems that controlling the focus might be a critical part of how the dropdown menu works, so instead I suspect it might be a better solution to add the sameSub
component to thePopover
package.It's not great for my team to support, document, and maintain two separate components that have almost entirely the same functionality just for the ability to sometimes add sub menus, but because
onOpenAutoFocus
is controlled by the Dropdown Menu and not available as a prop, it doesn't work for all of our use cases.Example:
https://github.com/user-attachments/assets/ea4400f0-90d0-464b-a064-dea95d8b0380
This example works well for our combobox, but doesn't allow us to use this same component for other use cases where sub menus are needed.
Examples in other libraries
Radix already supports this in the
Dropdown Menu
component: https://www.radix-ui.com/primitives/docs/components/dropdown-menu#subWho does this impact? Who is this for?
Anyone who uses Popover. The functionality between the two is so similar that I find it confusing they're even separate components to begin with. The dropdown menu doesn't quite feel like a primitive, considering it has higher order patterns like checkboxes and radio groups built into it which area already available as primitives.