news.volyx.in

Why the Gov.uk Design System team changed the input type for numbers (technology.blog.gov.uk)

556 points by joelanman · 2417 days ago · 173 comments on HN

Article summary

The GOV.UK Design System team changed the input type for numbers from 'number' to 'text' with 'inputmode=numeric' and 'pattern=[0-9]*' due to usability problems with the 'number' type, including accessibility issues and incorrect handling of non-incrementable numbers. This change allows for better separation between user input and browser validation. The team also published new guidance on how to ask users for numbers. The change aims to improve the user experience and provide a more accessible and robust way of collecting numeric data.

Main themes

  • input type usability
  • accessibility
  • browser validation
  • server-side validation
  • form design
  • user experience

What commenters say

  • The 'number' input type is problematic due to its strict validation and potential for user confusion.
  • Using 'inputmode=numeric' and 'pattern=[0-9]*' provides a better user experience and allows for more flexible validation.
  • Browser validation can be inconsistent and may not provide adequate feedback to users, making server-side validation a better approach.
  • Credit card numbers and other identifiers that happen to be numeric should not be collected using the 'number' input type.
  • The 'inputmode' attribute is not widely supported and may not be suitable for all use cases.
  • Server-side validation is necessary to ensure data consistency and security, regardless of client-side validation methods.
  • User intent and input flexibility should be prioritized when designing forms and validation rules.