zed/crates/gpui_web
Baris Palaska ed4d201f50
gpui_web: Only cancel the native context menu when the app claims the right-click (#60892)
# Objective

The contextmenu listener cancelled the browser's native menu
unconditionally, so pages hosting a gpui app lost right-click entirely
wherever the app showed no menu of its own, and apps that do show one
had no native menu to suppress selectively.

## Solution

Record whether the right-button MouseDown dispatch was consumed (a
handler called stop_propagation, e.g. to open a custom menu) and cancel
the native menu only in that case: app menus win where they exist, the
browser menu everywhere else. Apps opening custom context menus should
mark the triggering mousedown consumed to opt in.

## Testing

Tested locally

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<img width="816" height="288" alt="context menu"
src="https://github.com/user-attachments/assets/c79cd2ef-d465-4431-8461-7a9feb922576"
/>


Release Notes:

- N/A
2026-07-20 05:31:27 +00:00
..
examples/hello_web
src gpui_web: Only cancel the native context menu when the app claims the right-click (#60892) 2026-07-20 05:31:27 +00:00
Cargo.toml gpui: Unify raw-window-handle dependency (#61193) 2026-07-17 13:41:05 +00:00
LICENSE-APACHE