Skip to content

Commit 2eb3c2f

Browse files
author
web3blind
committed
Fix mobile notification and quest tab overlap
1 parent 64f243e commit 2eb3c2f

6 files changed

Lines changed: 43 additions & 18 deletions

File tree

app/css/main.css

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ body {
307307

308308
/* Toast */
309309
#toast-container {
310-
position: fixed;
310+
position: sticky;
311311
top: 0;
312312
left: 0;
313313
right: 0;
@@ -353,11 +353,14 @@ body {
353353

354354
/* Connection status */
355355
#connection-status {
356-
position: fixed;
357-
top: 8px;
358-
left: 50%;
359-
transform: translate(-50%, -120%);
356+
position: sticky;
357+
top: 0;
358+
left: auto;
359+
right: auto;
360+
transform: none;
361+
display: none;
360362
text-align: center;
363+
margin: 6px auto 0;
361364
padding: 6px 12px;
362365
background: rgba(13, 17, 23, 0.88);
363366
color: var(--color-text-muted);
@@ -366,16 +369,18 @@ body {
366369
border: 1px solid rgba(255,255,255,0.08);
367370
border-radius: 999px;
368371
z-index: 300;
369-
transition: transform 0.25s ease, opacity 0.25s ease;
372+
transition: opacity 0.25s ease;
370373
opacity: 0;
371374
pointer-events: none;
372-
white-space: nowrap;
375+
white-space: normal;
376+
width: max-content;
373377
max-width: calc(100vw - 24px);
374378
overflow: hidden;
375379
text-overflow: ellipsis;
376380
}
377381
#connection-status.show {
378-
transform: translate(-50%, 0);
382+
display: block;
383+
transform: none;
379384
opacity: 1;
380385
}
381386

@@ -1030,8 +1035,21 @@ body {
10301035
/* Quest Screen */
10311036
.quests-screen { max-width: 480px; margin: 0 auto; }
10321037
.quests-screen h1 { margin-bottom: 16px; }
1033-
.quest-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
1034-
.quest-tabs .btn { flex: 1; min-width: 70px; }
1038+
.quest-tabs {
1039+
display: grid;
1040+
grid-template-columns: repeat(2, minmax(0, 1fr));
1041+
gap: 8px;
1042+
margin-bottom: 16px;
1043+
}
1044+
.quest-tabs .btn {
1045+
width: 100%;
1046+
min-width: 0;
1047+
min-height: var(--touch-target);
1048+
padding: 8px 6px;
1049+
white-space: normal;
1050+
line-height: 1.15;
1051+
overflow-wrap: anywhere;
1052+
}
10351053
.quest-tabs .btn.active { background: var(--color-primary); color: #000; }
10361054

10371055
.quest-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

app/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="manifest" href="manifest.json">
1212
<link rel="icon" type="image/png" sizes="192x192" href="assets/icons/icon-192.png">
1313
<link rel="apple-touch-icon" href="assets/icons/icon-192.png">
14-
<link rel="stylesheet" href="css/main.css?v=20260711a">
14+
<link rel="stylesheet" href="css/main.css?v=20260711b">
1515
<link rel="stylesheet" href="css/themes.css">
1616
<link rel="stylesheet" href="css/accessibility.css">
1717
</head>
@@ -171,7 +171,7 @@
171171
<!-- UI Components -->
172172
<script src="js/ui/sound.js"></script>
173173
<script src="js/ui/components/progress-bar.js"></script>
174-
<script src="js/ui/components/toast.js?v=20260711a"></script>
174+
<script src="js/ui/components/toast.js?v=20260711b"></script>
175175
<script src="js/ui/components/modal.js"></script>
176176
<script src="js/ui/components/nav.js"></script>
177177
<script src="js/ui/components/battle-narrator.js"></script>

app/js/ui/components/toast.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ var Toast = (function() {
1313
container.id = 'toast-container';
1414
container.setAttribute('aria-live', 'polite');
1515
container.setAttribute('role', 'status');
16-
document.body.appendChild(container);
16+
var appMain = document.getElementById('app-main');
17+
if (appMain && appMain.parentNode) {
18+
appMain.parentNode.insertBefore(container, appMain);
19+
} else {
20+
document.body.appendChild(container);
21+
}
1722
}
1823
return container;
1924
}

app/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Viz Magic — Service Worker
2-
var CACHE_NAME = 'viz-magic-v29';
2+
var CACHE_NAME = 'viz-magic-v30';
33
var ASSETS = [
44
'/',
55
'/index.html',

tests/core-screen-accessibility-smoke.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function run() {
9090
var badLogs = logs.filter(function(l) { return l.type === 'error' || l.type === 'pageerror'; });
9191
assert.deepStrictEqual(failed, [], 'all core screens should render with named controls and no raw keys');
9292
assert.deepStrictEqual(badLogs, [], 'core screen smoke should not emit console errors/page errors');
93-
assert.ok(result.cachesKeys.indexOf('viz-magic-v29') !== -1, 'service worker cache should use latest cache name');
93+
assert.ok(result.cachesKeys.indexOf('viz-magic-v30') !== -1, 'service worker cache should use latest cache name');
9494
assert.ok(result.scripts.some(function(src) { return src.indexOf('helpers.js?v=20260621l') !== -1; }), 'helpers script should be cache-busted');
9595
assert.ok(result.scripts.some(function(src) { return src.indexOf('territory.js?v=20260621l') !== -1; }), 'territory script should be cache-busted');
9696
assert.ok(result.scripts.some(function(src) { return src.indexOf('state-engine.js?v=20260621m') !== -1; }), 'state engine script should be cache-busted');

tests/player-bug-regressions.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ test('high-traffic UI narration, screen announcements, and inventory stat labels
335335

336336
test('service worker updates quickly and keeps navigations network-first', function () {
337337
const swJs = read('app/sw.js');
338-
assert.ok(/viz-magic-v29/.test(swJs), 'service worker cache version should be bumped');
338+
assert.ok(/viz-magic-v30/.test(swJs), 'service worker cache version should be bumped');
339339
assert.ok(/self\.skipWaiting\(\)/.test(swJs), 'service worker should activate new cache without waiting for all tabs to close');
340340
assert.ok(/self\.clients\.claim\(\)/.test(swJs), 'service worker should claim clients after activation');
341341
assert.ok(/event\.request\.mode === 'navigate'[\s\S]*fetch\(event\.request\)/.test(swJs), 'navigation requests should prefer network to avoid stale cached index');
@@ -374,9 +374,11 @@ test('mobile entry helpers cover keyboard paste, home-screen shortcut, nav parit
374374
assert.ok(/var PRIMARY_HOME_SCREENS = \['home', 'hunt', 'map', 'guild', 'marketplace', 'crafting', 'character', 'help', 'leaderboard'\]/.test(homeJs), 'home primary grid should mirror bottom nav screens');
375375
assert.ok(/nav_bazaar/.test(homeJs) && /nav_crafting/.test(homeJs), 'home primary labels should reuse bottom-nav translation keys');
376376
assert.ok(/actionType === 'chronicle_post'[\s\S]*_normalizeDedupeText/.test(chronicleJs), 'chronicle post dedupe should ignore temporary block numbers');
377-
assert.ok(/top:\s*0/.test(mainCss) && /toast-strip/.test(mainCss), 'toast CSS should render as a compact top strip');
377+
assert.ok(/insertBefore\(container, appMain\)/.test(toastJs), 'toast strip should be inserted before app-main so it does not cover headings');
378+
assert.ok(/#connection-status[\s\S]*position:\s*sticky/.test(mainCss), 'connection status should stay in normal flow instead of covering headings');
379+
assert.ok(/\.quest-tabs[\s\S]*grid-template-columns:\s*repeat\(2, minmax\(0, 1fr\)\)/.test(mainCss), 'quest tabs should render as a two-column mobile grid');
378380
assert.ok(/role', type === 'error' \? 'alert' : 'status'/.test(toastJs), 'only errors should be assertive toast alerts');
379-
assert.ok(/viz-magic-v29/.test(read('app/sw.js')), 'service worker cache should be bumped for UI changes');
381+
assert.ok(/viz-magic-v30/.test(read('app/sw.js')), 'service worker cache should be bumped for UI changes');
380382
});
381383

382384
if (process.exitCode) {

0 commit comments

Comments
 (0)