diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 237a5258db..dcdac6a974 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -4117,8 +4117,8 @@ which embeds the MAP_KEY. > click-through backdrop tints the globe behind it (`.first-run-backdrop`, a > 28% dark tint with no blur); it never takes input, so the card stays > non-modal. The last step links out to the GitHub repository and -> Halfpixel's channels (YouTube, X, Instagram, LinkedIn, bilawal.ai, -> halfpixel.ai); each opens in a new tab with `rel="noopener noreferrer"`, and +> its author's channels (YouTube, X, Instagram, LinkedIn, bilawal.ai) and +> halfpixel.ai; each opens in a new tab with `rel="noopener noreferrer"`, and > the addresses live in `FIRST_RUN_LINKS` (`src/firstRunCopy.js`). The GEV > Stories card's BROWSE STORIES button closes the card (a session dismissal, > like Skip) and opens the in-app Stories Explore view, keeping the Stories diff --git a/src/firstRunLauncherView.test.mjs b/src/firstRunLauncherView.test.mjs index 7925e87e8b..a8041fd35d 100644 --- a/src/firstRunLauncherView.test.mjs +++ b/src/firstRunLauncherView.test.mjs @@ -182,7 +182,11 @@ test('a busy mission marks the choices aria-disabled, never disabled', async (t) 0, 'the new action cannot launch during the step transition', ); + // A press begun during the transition and released after it runs nothing. + enter.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true })); await settle(frames); + enter.dispatchEvent(new MouseEvent('click', { bubbles: true, detail: 1 })); + assert.equal(calls, 0, 'a press held through the step change never launches'); assert.ok( document.activeElement === enter, 'the primary action retains focus', @@ -341,6 +345,22 @@ test('BROWSE STORIES closes the card and opens Stories in place', async (t) => { assert.equal(opened, 1, 'a closing card cannot open Stories again'); }); +test('BROWSE STORIES keeps the welcome up when Stories refuses to open', async (t) => { + const { root, pinia, frames, sessionStorageRef } = await launch(t); + const stories = useStoriesStore(pinia); + stories.connect({ open: () => false }); + await move(root, frames); + await move(root, frames); + root.querySelector('[data-first-run-stories]').click(); + await nextTick(); + assert.equal(root.classList.contains('visible'), true, 'the card stays'); + assert.equal(sessionStorageRef.read(), null, 'not dismissed'); + assert.equal( + document.body.classList.contains('first-run-opening-stories'), + false, + ); +}); + test('the Stories card is left out where Stories is not offered', async (t) => { const { root, pinia, frames } = await launch(t); const stories = useStoriesStore(pinia); diff --git a/src/ui/styles/first-run.css b/src/ui/styles/first-run.css index e3c133aa86..f711fd8b9b 100644 --- a/src/ui/styles/first-run.css +++ b/src/ui/styles/first-run.css @@ -1684,6 +1684,12 @@ body.scene-playback-mode .first-run-backdrop { justify-content: center; white-space: nowrap; } + /* A status line (a mission that could not open) takes its own row above + the buttons instead of a sliver beside the checkbox and BACK. */ + .first-run-footer .first-run-note:not(:empty) { + flex: 1 0 100%; + order: -1; + } } /* Short viewports — landscape phones, small laptop windows. The chrome tightens diff --git a/src/ui/views/WelcomeView.vue b/src/ui/views/WelcomeView.vue index 0bee086e61..5bcf1d00b3 100644 --- a/src/ui/views/WelcomeView.vue +++ b/src/ui/views/WelcomeView.vue @@ -34,8 +34,18 @@ function go(next, event) { direction.value = next > step.value ? 'forward' : 'back'; step.value = Math.min(STEPS, Math.max(1, next)); } +// A press belongs to the step it began on: one begun while the steps were +// changing (and released after) runs nothing. Keyboard clicks (detail 0) +// have no press. +let pressedOn = null; +function onPrimaryDown() { + pressedOn = settling.value ? null : step.value; +} function onPrimary(event) { if (settling.value || event.detail > 1) return; + const pressed = pressedOn; + pressedOn = null; + if (event.detail === 1 && pressed !== step.value) return; if (step.value < STEPS) go(step.value + 1, event); else controls.value?.choose(start.value); } @@ -44,16 +54,27 @@ function onPrimary(event) { // so it does not flash up between the card closing and Explore opening; it is // still not marked seen. The card is left out where Stories is not offered. const stories = useStoriesStore(); +let openingStories = false; function openStories(event) { if (event?.detail > 1) return; if (settling.value || launcher.value?.busy === 'true' || launcher.value?.closing) return; if (!stories.available || !stories.controller) return; + if (openingStories) return; const body = globalThis.document?.body; + // Stories says at once whether it opens (it refuses while another mode + // holds the globe): only then does the card close, so a refusal never + // leaves nothing on screen. + const opening = stories.controller.open(); + if (opening === false) return; + openingStories = true; body?.classList.add('first-run-opening-stories'); controls.value?.dismiss(); - Promise.resolve(stories.controller.open()).finally(() => - body?.classList.remove('first-run-opening-stories'), - ); + Promise.resolve(opening) + .catch(() => {}) + .finally(() => { + openingStories = false; + body?.classList.remove('first-run-opening-stories'); + }); } function onPrimaryKeydown(event) { if (event.repeat) event.preventDefault(); @@ -278,7 +299,7 @@ function onSuppress(event) { -