diff --git a/server/web/index.html b/server/web/index.html index fa947c7..59af9ff 100644 --- a/server/web/index.html +++ b/server/web/index.html @@ -1873,6 +1873,24 @@ } function showPage(pageId) { + // Leaving the remote-desktop page? Drop fullscreen first. + // #screen-page is the requestFullscreen target; while it remains + // the document.fullscreenElement the browser blocks pointer / + // keyboard interaction with anything outside its subtree — + // devices-page lives outside it, so without this exit a click + // ANYWHERE on the device list silently no-ops until the user + // hits ESC themselves. Same hazard for device_offline auto- + // navigation, manual Back, and any future navigation we add. + if (pageId !== 'screen-page') { + const sp = document.getElementById('screen-page'); + if (sp && sp.classList.contains('active')) { + if (document.fullscreenElement || document.webkitFullscreenElement) { + const exit = document.exitFullscreen || document.webkitExitFullscreen; + if (exit) exit.call(document).catch(() => {}); + } + sp.classList.remove('pseudo-fullscreen'); // iOS fallback path + } + } document.querySelectorAll('.page').forEach(p => p.classList.remove('active')); document.getElementById(pageId).classList.add('active'); }