Launch from the welcome only on a press made on its step, and keep it up if Stories refuses

From review:
- A press begun while the steps were changing and released after (a click
  aimed at NEXT) ran ENTER GOD MODE; a press now belongs to the step it
  began on. Keyboard activation is unchanged.
- BROWSE STORIES closed the card before asking Stories to open, so a
  refusal (another mode holding the globe) left nothing on screen; the card
  closes only once Stories opens.
- On phones a mission's error line was squeezed beside the checkbox and
  BACK; it takes its own row above the buttons.
- CURRENT-STATE calls the YouTube, X, Instagram, LinkedIn and bilawal.ai
  links the author's channels, as the card does.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju authored and Sameh Khamis committed 2026-11-18 17:00:10 -08:00
1 parent e342149a09
commit 0936da98a9
4 files changed
+53 -6

No files matched your search

+20
View File
@@ -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);
+6
View File
@@ -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
+25 -4
View File
@@ -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) {
<!-- The card's main action: God mode, starting where the selected tile
says (a clean globe by default). -->
<button v-if="step > 1" type="button" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</button>
<button type="button" class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
<button type="button" class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <span class="material-symbols-outlined" aria-hidden="true">arrow_forward</span>
</button>
</div>