Web forms can be made much more usable with a few HTML attributes. Short summary:
- 
  typeShow archive.org snapshot : Tells browsers about the input data type. Mobile browsers will select a virtual keyboard based on this value. Some browsers will add simple validation, e.g. for typeemail.
- 
  inputmodeShow archive.org snapshot : Direct hint about the virtual keyboard to use. Inferred fromtype, but can be very handy when used explicitly:- Combining type="text"withinputmode="numeric"will start with a numeric virtual keyboard, but still allow other characters.
- Combining type="text"withinputmode="numeric"will not show number increment/decrement buttons on desktop.
- Combining inputmode="numeric"withpattern="[0-9]"offers a numbers-only keyboard.
 
- Combining 
- 
  enterkeyhintShow archive.org snapshot : Change the label of the "enter" button on virtual keyboards, e.g.next,go,search.
- 
  autocompleteShow archive.org snapshot : By marking input fields with their expected input (e.g.username,email,current-password,cc-number), browsers can offer a better autocomplete experience. There's a host of possible values.
Try it live!
  Better Mobile Inputs
  
    Show archive.org snapshot
  
 offers an interactive editor for type, inputmode and autocomplete – including a live preview for iOS and Android! It also serves as a nice reference for available values.
Posted by Dominik Schöler to makandra dev (2023-07-07 05:42)