Skip to content

Commit

Permalink
Listen for visibilitychange event
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Sep 16, 2024
1 parent d5d8d61 commit bdf0d18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/eframe/src/web/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub(crate) fn install_event_handlers(runner_ref: &WebRunner) -> Result<(), JsVal
fn install_blur_focus(runner_ref: &WebRunner, target: &EventTarget) -> Result<(), JsValue> {
// NOTE: because of the text agent we sometime miss 'blur' events,
// so we also poll the focus state each frame in `AppRunner::logic`.
for event_name in ["blur", "focus"] {
for event_name in ["blur", "focus", "visibilitychange"] {
let closure = move |_event: web_sys::MouseEvent, runner: &mut AppRunner| {
log::trace!("{} {event_name:?}", runner.canvas().id());
runner.update_focus();
Expand Down

0 comments on commit bdf0d18

Please sign in to comment.