Skip to content

[Feature Request] Allow users to return to previous step.  #39

Open

Description

@alexzhang1030

I think this is a good feature in some scences.

Activity

  1. changed the title [-][Feature Request] Allow users to turn to previous step. [/-] [+][Feature Request] Allow users to return to previous step. [/+] on Feb 15, 2023
  2. ulken commented on Feb 18, 2023

    @ulken
    Collaborator

    I'm not sure how this would work since each prompt is detached from the rest. Once a prompt has finalized, the library has no reference to it any longer.

    One plausible way would be via the group utility. Maybe we can pass hooks to each prompt initializer to go back and forward in history within the group. There we would could potentially store references to each prompt and provide a mechanism for them to clear themselves.

    Thoughts @natemoo-re?

  3. fvsch commented on Apr 25, 2023

    @fvsch

    I was trying the clack demo on https://www.clack.cc/ and was surprised I could not go back to a previous step to fix a mistake.

    I guess the more the UX feels like a form, the more you expect form-like behavior. (For instance, my first intuition was to use Shift+Tab to “tab back” to the previous input.)

  4. DizzyHSlightlyVoided commented on Jul 12, 2025

    @DizzyHSlightlyVoided

    This seems like something that could be added to Groups; some sort of "go back" input (as distinct from "cancel"), which would roll back to the previous step.

  5. 43081j commented on Mar 12, 2026

    @43081j
    Collaborator

    We should indeed do this I think, but by reworking how grouped prompts work imo.

    Today, a group is just a way to chain the various async tasks and populate a result object. We should probably extend or rework that to support re-running a task

  6. jolo-dev commented on Apr 14, 2026

    @jolo-dev

    It would be really great to have this.

  7. StringerBell69 commented on Oct 15, 2026

    @StringerBell69

    I've opened #617 which implements this for group().

    Pressing Shift+Tab returns to the previous step. Answers are kept and each step receives its previous answer as previous (pass it to initialValue to restore the entry). Back is disabled on the first step. It's on by default (navigate: false to opt out) and exposes an onBack({ from, to, results }) callback.

    Under the hood it adds an opt-in back action to @clack/core (unbound by default, so standalone prompts are unaffected), a BACK_SYMBOL/isBack() pair mirroring CANCEL_SYMBOL/isCancel(), and a 'back' state.

    Happy to adjust the approach per the discussion here — feedback welcome.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions