You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
autocomplete attribute for credit-card expiration details #4987
addition/proposalNew features or enhancementsi18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.topic: formsForms and form controls: input types, submission, constraint validation and autofill
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?
@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.
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.
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:
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.
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.
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.
addition/proposalNew features or enhancementsi18n-trackerGroup bringing to attention of Internationalization, or tracked by i18n but not needing response.topic: formsForms and form controls: input types, submission, constraint validation and autofill
Activity
annevk commentedon Oct 8, 2019
cc @mnoorenberghe
aphillips commentedon Oct 14, 2019
@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.
annevk commentedon Oct 14, 2019
cc @whatwg/i18n
domenic commentedon Oct 15, 2019
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-mmyyandcc-exp-year-yyinstead 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.
mnoorenberghe commentedon Nov 9, 2019
Sorry, just seeing the mention now…
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.
I am opposed to adding
cc-exp-year-yyas that is already addressed by<input maxlength=2 autocomplete=cc-exp-year>which Firefox (and I thought Chrome) already support. Spec text:I would be fine with stronger normative language added to the specification specific to this case (SHOULD or MUST) though.
Three thoughts:
4(no separator) or5(a single character separator, ideally defined inpatternso the browser can brute force some common options) with the existingcc-expwhich we could add to the spec if we want alignment on it.cc-exp.maxlengthand/orpatternto these authors seems equally likely to be effective.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.