Skip to content

autocomplete attribute for credit-card expiration details #4987

Open

Description

@battre

The autocomplete attribute for credit card attributes currently supports cc-exp, cc-exp-month and cc-exp-year.

This has a couple of issues:

cc-exp is described as a expiration time expressed in YYYY-MM format. All credit cards that I have seen so far print the expiration time in MM/YY format on the cards. This is also what websites ask for quite frequently.

cc-exp-year is described as the expiration year expressed in YYYY format. As stated above, all credit cards that I have seen use the YY format for the expiration year. This is also common on websites.

Should we introduce for example cc-exp-mmyy and cc-exp-year-yy?

Activity

  1. added
    addition/proposal
    topic: forms
    on Oct 8, 2019
  2. annevk commented on Oct 8, 2019

    @annevk
    Member
  3. aphillips commented on Oct 14, 2019

    @aphillips
    Contributor

    @annevk Can you add the i18n-tracking label please?

    In #4986 @battre mentions using a pattern string such as [mm/yy]. Pattern strings have the I18N disadvantage that translators have to puzzle out whether they need to translate the pattern (or not). A better mechanism used in more modern I18N APIs are "skeletons", which allow the locale to determine the best pattern to use to collect specific input. When this mechanism is used, translators and webdevs don't have to modify the the pattern when translating the page.

    Having said that, in this case the pattern isn't locale affected, so building in a specific format makes more sense to me.

  4. added
    i18n-tracker
    on Oct 14, 2019
  5. annevk commented on Oct 14, 2019

    @annevk
    Member

    cc @whatwg/i18n

  6. domenic commented on Oct 15, 2019

    @domenic
    Member

    I haven't checked the historical record, but I would guess that when designing the spec, it was hoped that web authors would ask for YYYY format to get the nice autocomplete. Maybe the spec was designed when Y2K was fresher on everyone's minds.

    This doesn't seem to have happened, and so instead people are not getting autocomplete at all. So yeah, we should probably fix this.

    Personally I would prefer simple tokens of the form cc-exp-mmyy and cc-exp-year-yy instead of a new microsyntax inside the autocomplete tokens using [].

    I'll also note that we have precedent (with #3745 (comment)) for very weak "implementer interest" signals for expanding the autofill token list, which IMO is suitable for what is largely an ecosystem coordination mechanism.

  7. mnoorenberghe commented on Nov 9, 2019

    @mnoorenberghe

    Sorry, just seeing the mention now…

    All credit cards that I have seen so far print the expiration time in MM/YY format on the cards.

    FWIW, until recently I had a U.S. card with an expiration of MM/DD/YY but I agree that the industry seems to be converging on MM/YY.

    cc-exp-year is described as the expiration year expressed in YYYY format. As stated above, all credit cards that I have seen use the YY format for the expiration year. This is also common on websites.

    I am opposed to adding cc-exp-year-yy as that is already addressed by <input maxlength=2 autocomplete=cc-exp-year> which Firefox (and I thought Chrome) already support. Spec text:

    Where it's not possible for the canonical format to be used, user agents should use heuristics to attempt to convert values so that they can be used.

    I would be fine with stronger normative language added to the specification specific to this case (SHOULD or MUST) though.

    cc-exp-mmyy

    Three thoughts:

    1. Is there alignment on what separator character should be used between MM and YY? If not, it may be better to keep pushing authors towards two separate fields with the two existing tokens? I also don't want to add a microsyntax here.
    2. I think this could also potentially be addressed by a maxlength of 4 (no separator) or 5 (a single character separator, ideally defined in pattern so the browser can brute force some common options) with the existing cc-exp which we could add to the spec if we want alignment on it.
    • At quick glance I can't tell if Firefox already does this for filling but we definitely handle saving 2-digit years from cc-exp.
    1. Do we have reason to believe that sites that are currently affected by this issue (i.e. ones that use a single input and expect YY-MM (or some other separator) would adopt any new token we add? Suggesting maxlength and/or pattern to these authors seems equally likely to be effective.

    I haven't checked the historical record, but I would guess that when designing the spec, it was hoped that web authors would ask for YYYY format to get the nice autocomplete. Maybe the spec was designed when Y2K was fresher on everyone's minds.

    I suspect it was to align with <input type=month> but in the meantime it has become clear that credit card expiration fields should match what is displayed on the card for best results but that doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposali18n-trackertopic: forms

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions