This is a tradeoff decision, so decide by understanding the tradeoffs
There is no "right" answer here because you are trading off:
- The benefits of UX consistency with default browser behavior.
- The potential benefits of custom UX behavior to help users navigate the form faster.
- The benefit of consistent behavior for mouse vs tab focus.
- The benefit of consistent behavior within your form (i.e. should tabbing into an
input
provide consistent behavior within your form)
Additionally, it may help to understand why the mouse vs keyboard focus behaves differently:
- A mouse allows precise positioning of a cursor within the input box, so a UX decision has been made to give users more control by allowing the user to select the precise cursor location. A user with a mouse can still select the entire
input
by clicking and dragging.
- A Tab button doesn't have this ability so a UX decision has been made to select the entire text instead.
To make your decision, you can prioritize the following considerations depending on your app:
- Would a custom/non-default focus behavior help the user complete the form better? For example, if a user is most likely to replace (and not edit) the contents of an input box, then selection of the entire box may help the user complete the form faster.
- Are the benefits of #1 worth the cost of non-standard form behavior?
Only you can make that decision, but by understanding the tradeoffs you can make it in a well-reasoned way.