w3c / w3c/csswg-drafts

[css-text] Provide CSS support for automatic spacing (or other separators) in text input field

Open
#4,875 23 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-forms-1 css-text-4 Needs Design / Proposal topic: form controls
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

This is a feature request to allow styling of the text input field for formatted inputs like credit card or date or phone number with an area code. Currently this is not possible without using javascript.

Shown below is an example where a credit card number is split into groupings of four digits each:

image

In general, people tend to use comma separation or spaces between large numbers (like a credit card) to pin for accuracy of input. So in some ways this is an accessibility issue as well.

At this point all of the solutions out there require using javascript to format the inputted string by listening to the onblur event. There are even libraries from large providers to style the information fields such as this one from Stripe. Linked here is the Twitter thread that prompted this proposal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue discussion and the CSS Text context referenced in the title. The issue names no repository files, tests, or implementation entry points, and it does not define a settled syntax or acceptance criteria. Done would require an agreed specification for automatic separators in formatted text inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
accessibility, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.