Skip to content

Commit

Permalink
fix(input): Skip validation when going to previous field (#285)
Browse files Browse the repository at this point in the history
In my opinion, this would make user experience better. Say you made a typo in the previous field but you already went to the next one, now you *need* to fill the current field correctly before you can fix the previous field.

This also keeps validation intact, because the field still needs to be valid to progress to the next field.
  • Loading branch information
Sculas authored Nov 27, 2024
1 parent 2522a15 commit aad810d
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions field_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,6 @@ func (i *Input) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

switch {
case key.Matches(msg, i.keymap.Prev):
value := i.textinput.Value()
i.err = i.validate(value)
if i.err != nil {
return i, nil
}
cmds = append(cmds, PrevField)
case key.Matches(msg, i.keymap.Next, i.keymap.Submit):
value := i.textinput.Value()
Expand Down

0 comments on commit aad810d

Please sign in to comment.