adobe / adobe/spectrum-web-components

[Bug]: ActionMenu's onChange handler invoked twice for larger touch devices

Open
#5,556 1 comment 0 reactions 0 assignees View on GitHub
bug Component:Action menu SEV 3
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)

ActionMenu

### Expected behavior

The `@change` callback should be invoked once per action when using a larger touch screen device (ex: iPad).

### Actual behavior

The `@change` callback is being invoked *twice* per action when using a larger touch screen device.

Might be related to:
https://github.com/adobe/spectrum-web-components/issues/5511

### Screenshots

_No response_

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

_No response_

### How can we reproduce this issue?

Here's a fork of the bug:
Components in this fork are on v1.5.0
https://stackblitz.com/edit/vitejs-vite-iysux6uy?file=src%2Fmy-element.ts,package.json,index.html

Open the console, and toggle the device toolbar. Pick iPad as the device.
Click the menu, select an item. Asset in the console that "changed!" is logged twice.
Components v1.4.0 or earlier do not show the double invocation of the `@change` callback.

Issue is reproducible using the device emulator in Chrome as well as using the iPad emulator on Mac.
I can be reached internally @connorr on slack.

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

_No response_

### Severity

SEV 3

### Logs taken while reproducing problem

_No response_

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

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

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and the ActionMenu component, comparing behavior between versions 1.4.0 and 1.5.0 on the iPad device emulator. Confirm that selecting an item invokes the @change callback twice, then verify that the callback is invoked once per action after the change.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.