New branch: validation on the name field
Summary
Based on this research, I think would be great to use the "reward early, punish late" approach at the validation of the branch name:
- validate the branch name on the
blur
event, if the user is entering the data in the field that was in a valid state - validate the branch name on the
keyup
event, if the user is entering the data in the field that was in an invalid state
What is the current behavior?
Now the validation run just on the blur
event. It could be confusing, for example:
- Set the branch name input to "a-branch name-with-space"
- Focus to an other element
- Error message shows up
- Set the focus back to the branch name and remove the space from it
- The validation error still visible:
What is the expected correct behavior?
- Set the branch name input to "a-branch name-with-space"
- Focus to an other element
- Error message shows up
- Set the focus back to the branch name and remove the space from it
- The validation error should be immediately gone:
NOTE: maybe we should use this approach on the other forms around the site as well...
Edited by 🤖 GitLab Bot 🤖