Skip to content

Commit

Permalink
refactor(input): Skip validation when going to previous field
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 committed Jun 18, 2024
1 parent 90406d7 commit 5cc26f4
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 @@ -215,11 +215,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 5cc26f4

Please sign in to comment.