Fix dock panel visibility on mobile

This commit is contained in:
Admin 2026-09-21 00:55:19 +00:00
parent a8fcab58eb
commit 846af246d9
2 changed files with 9 additions and 1 deletions

View File

@ -81,6 +81,7 @@ style.textContent = `
font-family: Georgia, 'Times New Roman', serif;
}
#dock-overlay[hidden] { display: none; }
#dock-overlay [hidden] { display: none !important; }
.dock-backdrop {
position: absolute;
inset: 0;
@ -239,7 +240,11 @@ const panels = [...overlay.querySelectorAll('[data-panel]')];
let latestState = null;
const setPanel = (name = 'home') => {
panels.forEach((panel) => { panel.hidden = panel.dataset.panel !== name; });
panels.forEach((panel) => {
const active = panel.dataset.panel === name;
panel.hidden = !active;
panel.setAttribute('aria-hidden', active ? 'false' : 'true');
});
};
const actionButton = (label, action, extra = {}, disabled = false) => {

View File

@ -280,6 +280,9 @@ test('mobile controls enter a dock hub before shipyard, trade, or missions', asy
assert.match(dockUi, /MISSIONS/);
assert.match(dockUi, /TRADE/);
assert.match(dockUi, /SHIPYARD/);
assert.match(dockUi, /#dock-overlay \[hidden\] \{ display: none !important; \}/);
assert.match(dockUi, /panel\.hidden = !active/);
assert.match(dockUi, /panel\.setAttribute\('aria-hidden'/);
assert.match(dockUi, /dispatchAction\('open-shipyard'\)/);
assert.match(hud, /buyButton\.textContent = badges\.length/);
});