adobe / adobe/spectrum-web-components

[Bug]: ActionMenu: menu-item with href triggers link twice

Open
#5,511 0 comments 0 reactions 0 assignees View on GitHub
bug Component:Action menu SEV 4
Dominant language
TypeScript
Stars
1.5k
Forks
262
Avg merge
3d 10h
Merged PRs (30d)
68

Description

### Code of conduct

- [x] I agree to follow this project's code of conduct.

### Impacted component(s)

MenuItem, ActionMenu

### Expected behavior

When we add a href attribute to menu-item this link should only open once.

### Actual behavior

Adding an href attribute to an menu-item (and setting target="_blank") it opens two tabs instead of one.

### Screenshots

_No response_

### What browsers are you seeing the problem in?

Chrome

### How can we reproduce this issue?

1. Go to https://stackblitz.com/edit/vitejs-vite-rsqt9vbz?file=src%2Fmy-element.ts
2. Make sure Popup blocked is deactivated (or Popups are allowed for all sites)
3. Click on "More Actions" menu
4. Click on "Open link in new tab"
5. See that 2 tabs are opened

![Image](https://github.com/user-attachments/assets/639cb3ce-2efc-485e-86c9-afd6b811cd3f)
![Image](https://github.com/user-attachments/assets/26f067e5-5877-409f-8d11-b0cdba5d949a)

### Sample code or abstract reproduction which illustrates the problem

_No response_

### Severity

SEV 4

### Logs taken while reproducing problem

_No response_

### Would you like to track this issue in Jira?

- [ ] Yes, please tell me the ticket number!

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect the MenuItem and ActionMenu href handling involved in the "Open link in new tab" action. Reproduce the issue in Chrome with popups allowed; done means clicking the menu item opens exactly one tab.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.