From 60da4b4f65531bb78736c8f6471b55cc8febb1b1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 29 Mar 2024 10:59:24 +0100 Subject: [PATCH] Web: repaint if the `#hash` in the URL changes (#4261) Fixes a problem in egui.rs where the back-button would not work to switch between the top-level tabs --- crates/eframe/src/web/events.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/eframe/src/web/events.rs b/crates/eframe/src/web/events.rs index 30775733..c6737f6e 100644 --- a/crates/eframe/src/web/events.rs +++ b/crates/eframe/src/web/events.rs @@ -242,6 +242,7 @@ pub(crate) fn install_window_events(runner_ref: &WebRunner) -> Result<(), JsValu runner_ref.add_event_listener(&window, "hashchange", |_: web_sys::Event, runner| { // `epi::Frame::info(&self)` clones `epi::IntegrationInfo`, but we need to modify the original here runner.frame.info.web_info.location.hash = location_hash(); + runner.needs_repaint.repaint_asap(); // tell the user about the new hash })?; Ok(())