fix(mobile): fix stale popover closure and clean up test imports (#4520)

This commit is contained in:
Rod Boev committed 2026-06-20 21:35:37 -04:00
1 parent dee42a89cb
commit 96d3011209
2 files changed
+6 -8

No files matched your search

+5 -5
View File
@@ -154,20 +154,20 @@ function syncAppTitlebar() {
// Dismiss stale popover on session/panel switch // Dismiss stale popover on session/panel switch
const _existingPop = document.querySelector('.app-titlebar-title-popover'); const _existingPop = document.querySelector('.app-titlebar-title-popover');
if (_existingPop) _existingPop.remove(); if (_existingPop) { _existingPop.remove(); titleEl._titlePopover = null; }
// Mobile touch interactions // Mobile touch interactions
if ('ontouchstart' in window) { if ('ontouchstart' in window) {
// Tap-to-reveal full title popover — wired once per element lifetime // Tap-to-reveal full title popover — wired once per element lifetime
if (!titleEl._mobileTouchWired) { if (!titleEl._mobileTouchWired) {
titleEl._mobileTouchWired = true; titleEl._mobileTouchWired = true;
let _titlePopover = null; titleEl._titlePopover = null;
const _dismissTitlePopover = () => { const _dismissTitlePopover = () => {
if (_titlePopover) { _titlePopover.remove(); _titlePopover = null; } if (titleEl._titlePopover) { titleEl._titlePopover.remove(); titleEl._titlePopover = null; }
}; };
titleEl.addEventListener('click', function _onTitleClick(e) { titleEl.addEventListener('click', function _onTitleClick(e) {
if (_renamingAppTitlebar) return; if (_renamingAppTitlebar) return;
if (_titlePopover) { if (titleEl._titlePopover) {
_dismissTitlePopover(); _dismissTitlePopover();
return; return;
} }
@@ -181,7 +181,7 @@ function syncAppTitlebar() {
pop.style.top = (rect.bottom + 6) + 'px'; pop.style.top = (rect.bottom + 6) + 'px';
pop.style.left = Math.max(8, rect.left) + 'px'; pop.style.left = Math.max(8, rect.left) + 'px';
pop.style.maxWidth = (window.innerWidth - 16) + 'px'; pop.style.maxWidth = (window.innerWidth - 16) + 'px';
_titlePopover = pop; titleEl._titlePopover = pop;
const _outside = (ev) => { const _outside = (ev) => {
if (!pop.contains(ev.target) && ev.target !== titleEl) { if (!pop.contains(ev.target) && ev.target !== titleEl) {
_dismissTitlePopover(); _dismissTitlePopover();
@@ -1,11 +1,9 @@
"""Static regressions for mobile titlebar session title priority (#4520).""" """Static regressions for mobile titlebar session title priority (#4520)."""
import re, pathlib, pytest import pathlib
ROOT = pathlib.Path(__file__).parent.parent ROOT = pathlib.Path(__file__).parent.parent
HTML = (ROOT / "static" / "index.html").read_text(encoding="utf-8") HTML = (ROOT / "static" / "index.html").read_text(encoding="utf-8")
PANELS_JS = (ROOT / "static" / "panels.js").read_text(encoding="utf-8") PANELS_JS = (ROOT / "static" / "panels.js").read_text(encoding="utf-8")
STYLE_CSS = (ROOT / "static" / "style.css").read_text(encoding="utf-8")
SESSIONS_JS = (ROOT / "static" / "sessions.js").read_text(encoding="utf-8")
def test_titlebar_title_element_exists(): def test_titlebar_title_element_exists():