Skip to content

Restricting user input

JC Franco edited this page Feb 4, 2025 · 8 revisions

tags: [draft, conventions, components, development]

Outside of native form control contexts, intercepting and restricting user input is not always desired and can lead to unexpected behavior, so we have been moving away from this approach and leaving it up to developers to prevent input if this is necessary.

Considerations

  1. Handling of data pasted, autofilled by browser extension or populated by a database
    • data would be stripped without user knowledge
  2. Assuming user text workflows – related to 1, but some users might be working with an existing piece of text that can be edited down to the desired input

Exceptions

  • When component adheres to native form control + max-length constraints
  • When input is restricted to a deterministic range of values (e.g., hex color characters)

Related issues

Clone this wiki locally