I have an Ant Design Dropdown component in a React application. The dropdown includes submenus. Right now, the submenu items close when they're clicked on. I would like them to instead remain open on click.
The Ant Design docs have a solution for this for the base level dropdown menu items, however, this doesn't work for sub menu items.
I also came across this Github issue where the problem is supposedly solved. However, the solution uses the old overlay
prop for the Dropdown component, which is deprecated in favor of the menu
prop.
Finally, I tried adding a div around the label of the submenu items with onClick={(e) => e.stopPropagation()}
. This mostly works, except the menu item has some padding around itself, so the label does not take up the full space that the menu item takes up. Because of this, the submenu does not close when you click in the center of it (on the label), but it still closes if you click around the edge (on the padding).