Skip to content

fix: show the end screen in the editor's preview - #280

Closed
PhilReinking wants to merge 11 commits into
feat/bits-287-wordingfrom
fix/bits-285-preview-end-screen
Closed

PhilReinking wants to merge 11 commits into
feat/bits-287-wordingfrom
fix/bits-285-preview-end-screen

Conversation

@PhilReinking

@PhilReinking PhilReinking commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

The preview went only to questions. Now, while the end block is open, it shows the end screen with the saved headline, text and button, and goes back to a question you open. Settings now calls the completion page "End screen", like the document.

Part of BITS-285

  • The open end block sends the preview to a new target end, through the existing goto message and ?block=. Nothing reaches the server.
  • A form that sends people to a link gets a short note in the panel instead of the frame: nobody sees that end screen.
  • The end block's open state moved to blockFocus.ts, so the preview can read it.
  • In preview mode the end screen's button opens its link in a new tab, so the editor stays. Outside preview it's unchanged.
  • The preview takes focus only while its frame has it: typing in a question you open stays in the editor (bug from feat: show a live preview beside the document #273).
  • Esc inside the preview closes the panel over the document, through a new same-origin message.
  • "No end screen" shows only for an http(s) link, as the form redirects only there.

Tested: Vitest (16 of 18 new tests fail without the fix), lint, vue-tsc, build. By hand (1440, 390): end screen, headline save, back to question, nothing stored.

At 1440 also: button opens a new tab, typing after opening question 2 lands in it. Enter in the preview moves on (1440, 390); Esc there closes the panel (390).

Not tested: the redirect note and the button at 390 by hand (Vitest covers them). Stacked on #279, so no CI runs.

🤖 Generated with Claude Code

PhilReinking and others added 5 commits October 13, 2026 11:18
The preview went only to questions. Now the open end block sends the
preview to the end screen (nothing is sent), a save shows the new text,
and a form that sends people to a link gets a short note instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same name as the end block in the document. The #completion-page link
and the code names stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the editor's preview the button took the whole editor tab to its
link. Outside the preview it still opens in the same tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…280's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK at dd6cfb8, one nit inline. No CI (stacked), local runs: Vitest 491, lint, vue-tsc, build. 9 of the 10 new tests fail on c6354e6.

Tried at 1440 and 390: the preview follows the open end screen and each save, goes back to a question, and the button opens a new tab without window.opener. A stranger's preview link shows "Form not found". ?block=end and a posted goto leave a real form at question 1.

});
// the preview doesn't follow the link, so its end screen is one nobody sees
const redirect = computed(() =>
shown.value === END_SCREEN && store.form?.use_cta_redirect

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the public form redirects only to http(s) links (conversation.ts:574), but the API also takes mailto:. With a mailto: redirect people see the end screen, while this hides the frame and says "people go to mailto:…". Tried on the test server, put back after. The document's line (EndScreenBlock.vue:11, from #271) uses the same rule, so I'd change both, e.g. with isAllowedLink(store.form.cta_link, ["http:", "https:"]). Not run.

The preview's form put the cursor in its own field after each move, so
typing in a question just opened went into the preview. In preview mode
the form now never takes the focus on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PhilReinking and others added 2 commits October 13, 2026 12:00
The public form only goes to an http(s) link. With a mailto: link it
shows the end screen, so the document and the preview now show it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK at 83ec4a3, one should inline. No CI (stacked), local runs: Vitest 495, lint, vue-tsc, build. The 3 new tests fail on dd6cfb8.

Tried at 1440 with the preview open: after opening questions 1 to 3 or the end screen, typing lands in the editor. A mailto: redirect now shows the end screen in the document and the preview.

// the preview never takes the cursor from the editor around it
const focusDisabled = computed(() => {
return isLoading.value && !props.flags.autofocus;
return isPreview || (isLoading.value && !props.flags.autofocus);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: this also drops the cursor when someone clicks through the preview. On the real form, Enter on question 1 puts the cursor on question 2's choices. In a ?preview=1 tab and in the editor's frame it stays on the page. Tried on the test server. Maybe block focus only while the preview's window isn't focused, e.g. isPreview ? !windowFocused.value : … with useWindowFocus() from @vueuse/core. Not run.

PhilReinking and others added 3 commits October 13, 2026 12:14
The preview blocked focus all the time, so a keyboard user couldn't try
the form there. It now blocks focus only while its own window isn't
focused: the editor keeps the cursor, and Enter in the preview moves
on to the next question as on the real form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a tablet or phone the preview opens over the document. After a click
into the preview, Esc went to the form there and the panel stayed open.
The form in preview mode now tells the editor about Esc (same origin
both ways, like the other preview messages), and the panel closes with
focus back on the Preview button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@PhilReinking PhilReinking left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK at 1bb9bf6, the should from 83ec4a3 is fixed. No CI (stacked), local runs: Vitest 499, lint, vue-tsc, build. The 4 new tests fail on 83ec4a3.

Tried at 1440 and 390: Enter in a ?preview=1 tab or in the editor's frame puts the cursor on question 2, as on the real form. Typing after opening a question in the editor stays there. Esc inside the frame closes the phone panel and puts focus back on Preview.

@PhilReinking

Copy link
Copy Markdown
Contributor Author

Landed in main with #282 (the editor rebuild as one PR); this PR's commits are part of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant