nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Using `DropdownItem` as `Link` will open two windows simultaneously.

Open baijunjie opened this issue 2 months ago • 1 comments

NextUI Version

2.3.6

Describe the bug

import {
  Dropdown,
  DropdownTrigger,
  DropdownMenu,
  DropdownItem,
  Button,
  Link,
} from '@nextui-org/react';

function App() {
  return (
    <>
      <Dropdown>
        <DropdownTrigger>
          <Button variant="bordered">Open Menu</Button>
        </DropdownTrigger>
        <DropdownMenu aria-label="Static Actions">
          <DropdownItem as={Link} target="_blank" href="https://google.com">
            Open Google
          </DropdownItem>
        </DropdownMenu>
      </Dropdown>
    </>
  );
}

export default App;
image

Upon clicking, two windows will open simultaneously.

image

It's important to note that, by default, the browser will block one window, so it may seem like only one window is opened. However, if the browser's blocking is disabled, two windows will open. image

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-pbo2fn?file=package.json,src%2FApp.jsx&terminal=dev

Steps to Reproduce the Bug or Issue

none

Expected behavior

Open only one window.

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

baijunjie avatar May 03 '24 08:05 baijunjie