fix(tui): labeled single multi-select Enter as submit

This commit is contained in:
can1357
2026-08-16 02:05:42 +02:00
parent f83111c8d4
commit d5fd412115
2 changed files with 3 additions and 1 deletions
@@ -615,7 +615,7 @@ export class AskDialogComponent implements Component {
}
const question = this.#questions[this.#currentQuestionIndex()];
// Enter advances in multi-question dialogs and submits single-question ones.
const enterAction = this.#hasSubmitTab() ? "next" : "submit";
const enterAction = this.#questions.length > 1 ? "next" : "submit";
const action = question?.multi ? `Space toggle · Enter ${enterAction}` : "Enter select · n note";
const tabs = this.#hasSubmitTab() ? " · Tab/←/→" : "";
if (this.#questionCanPage && indicator) {
@@ -622,6 +622,7 @@ describe("AskDialogComponent", () => {
onCancel,
onPrompt,
});
expect(render(component)).toContain("Space toggle · Enter next");
// Space toggles Option A; Enter on the plain option row confirms and
// advances to Q2 instead of submitting the whole dialog (#8265 review).
@@ -1014,6 +1015,7 @@ describe("AskDialogComponent", () => {
onCancel: vi.fn(),
onPrompt: vi.fn(),
});
expect(render(component)).toContain("Space toggle · Enter submit");
// Space selects Option A; Enter submits right away — no need to
// discover the Submit tab (issue #8252).