diff --git a/crates/gpui_web/src/events.rs b/crates/gpui_web/src/events.rs index 31a37d527f..08434aada4 100644 --- a/crates/gpui_web/src/events.rs +++ b/crates/gpui_web/src/events.rs @@ -151,21 +151,13 @@ impl WebWindowInner { current_state.modifiers = modifiers; } - let result = this.dispatch_input(PlatformInput::MouseDown(MouseDownEvent { + this.dispatch_input(PlatformInput::MouseDown(MouseDownEvent { button, position, modifiers, click_count, first_mouse: false, })); - - // The browser fires `contextmenu` after this event; remember whether - // the app claimed the right-click (e.g. opened its own menu) so the - // contextmenu listener cancels the native menu only in that case. - if button == MouseButton::Right { - let claimed = result.is_some_and(|result| !result.propagate); - this.app_claimed_right_click.set(claimed); - } }) } @@ -279,12 +271,9 @@ impl WebWindowInner { } fn register_context_menu(self: &Rc) -> Closure { - let this = Rc::clone(self); self.listen("contextmenu", move |event: JsValue| { let event: web_sys::Event = event.unchecked_into(); - if this.app_claimed_right_click.replace(false) { - event.prevent_default(); - } + event.prevent_default(); }) } diff --git a/crates/gpui_web/src/window.rs b/crates/gpui_web/src/window.rs index 5f4223572b..b9399d32e6 100644 --- a/crates/gpui_web/src/window.rs +++ b/crates/gpui_web/src/window.rs @@ -55,7 +55,6 @@ pub(crate) struct WebWindowInner { pub(crate) last_physical_size: Cell<(u32, u32)>, pub(crate) notify_scale: Cell, pub(crate) is_composing: Cell, - pub(crate) app_claimed_right_click: Cell, mql_handle: RefCell>, pending_physical_size: Cell>, } @@ -183,7 +182,6 @@ impl WebWindow { last_physical_size: Cell::new((0, 0)), notify_scale: Cell::new(false), is_composing: Cell::new(false), - app_claimed_right_click: Cell::new(false), mql_handle: RefCell::new(None), pending_physical_size: Cell::new(None), });