adobe / adobe/spectrum-web-components
[Bug]: sp-overlay needs 2 clicks to close on Windows with notImmediatelyClosable set
- 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)
Overlay
### Expected behavior
When using the `sp-overlay` [imperative API](https://opensource.adobe.com/spectrum-web-components/components/imperative-api/#notimmediatelycloseable) to create a custom right-click menu, the `notImmediatelyClosable` prop is supposed to prevent a `pointerup` event from closing the Overlay. However, any subsequent left click should close the overlay.
### Actual behavior
This is working fine on Mac, but, on Windows, the `pointerup` event is firing before the `contextmenu` event that is used to trigger the menu open. So it needs 2 clicks to close the custom menu.
### Screenshots
https://github.com/adobe/spectrum-web-components/assets/7351026/9fa5f923-fc81-4d58-b9c9-41f3f8ac77c6
### What browsers are you seeing the problem in?
Chrome, Microsoft Edge
### How can we reproduce this issue?
1. Go to https://opensource.adobe.com/spectrum-web-components/components/imperative-api/#using-a-virtual-trigger on a Windows system
2. Right click in the bounded rectangle to open custom context menu
3. Left click anywhere outside the menu
4. Observe that first click does not close the menu
5. Click again and observe that menu closes
### Sample code that illustrates the problem
_No response_
### Logs taken while reproducing problem
_No response_
Contributor guide
Research direction
Reproduce the issue from the imperative API's virtual-trigger example on Windows in Chrome or Edge, using the sp-overlay context-menu steps described here. Trace the pointerup and contextmenu event ordering around notImmediatelyClosable. Done means the first left click outside the custom menu closes it without requiring a second click.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100