[css-selectors] Expose date input picker affordance as a pseudo element
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
Some browsers include a small calendar icon as an extra visual affordance and/or focusable date picker toggle for input elements with a type of date.
Here is an example of a barebones <input type="date"> in Firefox:
In Chrome and Edge, this affordance may be selected using the -webkit-calendar-picker-indicator pseudo element. But there is currently no comparable element in Firefox, and no documented standard that I could find (though @AmeliaBR kindly pointed me toward related issues like #5365 and #3934).
The most common use case for having this pseudo element would be to customize the appearance of the icon, perhaps for consistency with the rest of a site's experience. The use case I personally encountered was simpler: We had a report of users being confused by an affordance-less date input in Safari. We wanted to provide our own calendar icon, but only for browsers that didn't provide their own.
In theory, we'd be able to use some CSS like this (see CodePen example):
@supports not selector(::-webkit-calendar-picker-indicator) {
input[type=date] {
background-image: url('calendar-icon.svg');
}
}
This works great in Chromium, which shows the native affordance:
And Safari, which shows the fallback image:
But since Firefox doesn't have a comparable pseudo element to test against, it shows both the fallback and the native affordance:
It would be helpful to have a standard in place for consistency.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linked Firefox Bugzilla report and related CSSWG issues #5365 and #3934, then examine how the CSSWG drafts handle comparable pseudo-elements. Done means the Working Group has resolved the proposed date-picker affordance and specified its interoperable pseudo-element behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100