Skip to content

Allow user to go back in form when current input is invalid #720

@iocalebs

Description

@iocalebs

Description

If a form input is in an invalid state, the user is "stuck" on that input until they fix it—they can't move forward or backward.

Shouldn't a user still be able to go back in the form and change previous inputs before proceeding? Especially if the validity of input B depends on the value of input A...

Current behaviour

	form := huh.NewForm(
		huh.NewGroup(
			huh.NewInput().
				Title("Input A"),
			huh.NewInput().
				Title("Input B").
				// can't move back to A until entering a value for B
				Validate(huh.ValidateNotEmpty()),
		),
	)

	form.Run()
Image

Above screenshot shows state after trying to shift+tab back from input B to input A.

Desired behaviour

Allow user to go backwards - only prevent them from moving forward past the invalid input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions