From 317dffe8860d9320f58dc58820df605af42e6fc0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 30 Mar 2026 11:06:42 -0600 Subject: [PATCH] [gpu] Redraw on visibility change and context restore Fixes black screen after phone lock/unlock or tab switch. Co-Authored-By: Claude Opus 4.6 (1M context) --- util/gpu/web/shell.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/gpu/web/shell.html b/util/gpu/web/shell.html index 0b6b85a4f..ccff40acb 100644 --- a/util/gpu/web/shell.html +++ b/util/gpu/web/shell.html @@ -127,6 +127,8 @@ tap: animate · dbl-tap+drag: zoom · long-press: reset } resizeCanvas(); window.addEventListener('resize', resizeCanvas); + document.addEventListener('visibilitychange', resizeCanvas); + canvas.addEventListener('webglcontextrestored', resizeCanvas); /* Backend selector */ var isWebGPU = location.pathname.indexOf('webgpu') !== -1;