Right click on "Ant Design's Collapse Menu Item" doesn't show "Open in New Tab"


Yurio Aleman Jimenez

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

The problem is that when I try to right click on the menu item, it doesn't show the option to "open in new tab/window".

I suspect it has something to do with this issue , because when I use the code inspector, Ant Design's accordion menu items don't use labels adirectly .

How do I get the right-clicked "Open in new tab/window" option to display when I click on the Ant Design's collapsed menu item? ? ?

edit

The code I have is very much like this:

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

But my app has 30+ menu items, so putting a label aon each item is a solution that requires a lot of text. I want to apply a dynamic solution to this problem in execution time.

Triyugi Narayan玛尼

You can add anchor tags anytime , anywhere . Just like in " collapsed inline menus" , you can use the following methods:

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

I have created a working demo , please check.

Related


Selenium doesn't follow click to open new tab

Anonymous 0441 For a long time I had a problem using selenium to find the button I was looking for on the page. After a week, I had a "nice" idea to check the url where selenium was searching for the button. Fake me, this is the wrong url. So the problem is, s

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done, my links stop responding to left clicks. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the browse

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

Right click on svg to open new tab with element

Yukulele With firefox, when I middle-click (or ctrl+click) on an useelement , it will open the url xlink:hrefin a new tab (like href) Bug or feature? <svg viewBox="0 0 400 80"> <circle id="circle" cx="40" cy="40" r="30" fill="#29e"></circle> <use xlink

Right click on svg to open new tab with element

Yukulele With firefox, when I middle-click (or ctrl+click) on an useelement , it opens the url xlink:hrefin a new tab (like href) Bug or feature? <svg viewBox="0 0 400 80"> <circle id="circle" cx="40" cy="40" r="30" fill="#29e"></circle> <use xlink:hre

Right click to enable "open in new tab/window"

Michael Chodakis My link is a javascript function that shows the loader and then navigates to the target link: <script> function go(url) { document.body.innerHTML = "some loader html"; window.location = url; } </script> <a href="javascript:go('test.php');"

Right click and save link to open in new tab

Dishu I added a custom right click menu using jquery in my project, now what I want to achieve is: -> If anyone right clicks on the link, the option will say "Open link in new tab", when that option is selected, it will open in a new tab with that link. -> Oth

Right click on svg to open new tab with element

Yukulele With firefox, when I middle-click (or ctrl+click) on an useelement , it opens the url xlink:hrefin a new tab (like href) Bug or feature? <svg viewBox="0 0 400 80"> <circle id="circle" cx="40" cy="40" r="30" fill="#29e"></circle> <use xlink:hre

Right click to enable "open in new tab/window"

Michael Chodakis My link is a javascript function that shows the loader and then navigates to the target link: <script> function go(url) { document.body.innerHTML = "some loader html"; window.location = url; } </script> <a href="javascript:go('test.php');"

The link doesn't open in a new tab

Alan Weber Here is my javascript code, I want the link should open in new tab but it doesn't happen, how can I do that? <link href="http://vjs.zencdn.net/5.4.6/video-js.min.css" rel="stylesheet"> <script src="http://vjs.zencdn.net/5.4.6/video.min.js"></script>

CakePHP open to new tab on click

mark I have a function in my app where user can upload files to web server. These uploaded files will then appear in another page where another type of user can click the link. After clicking the link, a new tab will open and the file will be displayed. But I

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

Click the button to open a new tab

Nathan Wilson I want to create a link with a button that opens in a new tab. The code I'm currently using is currently opening a blank tab and I'm not sure why. <div class="text text-left"> <h2>WORK</h2> <h1>Title</h1> <p>Lorem ipsum dolor sit am

CakePHP open to new tab on click

mark I have a function in my app where user can upload files to web server. These uploaded files will then appear in another page where another type of user can click the link. After clicking the link, a new tab will open and the file will be displayed. But I

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Selenium C# Open "New" tab CTRL+T doesn't work with CHROME

crush static void Main() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://google.com"); IWebElement body = driver.FindElement(By.TagName("body")); body.SendKeys(Keys.Control + "t"); } This is the code I'm trying to

Open a new tab after button click in AngularJS

Neptune: <button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $http.post('www.google.com'); } What I want is to post a requirement and then open the response html in a new tab when the "openTab" button