3

I have a React App that use Ant Design. It uses the Ant Design Menu component, in collapsed mode.

The thing is when I try to right click on a menu item, it do not show the options to "Open in new tab/window".

I suspect that it has relation with this question, because when I use the code inspector, the collapsed menu item of Ant Design don't use a tags directly.

How can I achieve that the "Open in new tab/window" options of right click appears when I click on collapsed menu items of Ant Design???

EDIT

The code I have is pretty like this:

<Menu.Item
    key="menu_1"
    onClick={() => {
        window.location.href = '../path/to/route';
    }}
>
    Dashboard
</Menu.Item>

But my application has more than 30 menu items, so putting an a tag on each item is a solution that require many text. I want to apply a dynamic solution in execution time for this issue.

Yulio Aleman Jimenez
  • 1,642
  • 3
  • 17
  • 33

1 Answers1

2

You can always add anchor tag wherever you want. Like in Collapsed inline menu, you can use as follows:

<Menu.Item key="3">
    <Icon type="inbox" />
    <span>
        <a href="#">Option 3</a>
    </span>
</Menu.Item>

I have created a working demo, please check.

Triyugi Narayan Mani
  • 3,039
  • 8
  • 36
  • 56