Designing The Perfect Date And Time Picker – Smashing Magazine
Vitaly’s been bitten with date-picker fever. Here’s his deep, deep, deep dive into one interface element.
I quite like this date-picking interface. It would be nice if browsers picked it up for input type="date"
.
Vitaly’s been bitten with date-picker fever. Here’s his deep, deep, deep dive into one interface element.
This ever-growing curated collection of interface patterns on CodePen is a reliable source of inspiration.
I think this a solution worthy of Solomon. In this case, the Gordian knot is the select
element and its inevitable recreation in order to style it.
What if we instead deliver a native select by default and replace it with a more aesthetically pleasing one if possible? That’s where the “hybrid” select idea comes into action. It’s “hybrid” because it consists of two selects, showing the appropriate one at the right moment:
- A native select, visible and accessible by default
- A custom select, hidden until it’s safe to be interacted with a mouse
The implementation uses a genius combination of a hover
media query and an adjacent sibling selector in CSS. It has been tested on a number of device/platform/browser combinations but more tests are welcome!
What I love about this solution is that it satisfies the stakeholders insisting on a custom component but doesn’t abandon all the built-in accessibility that you get from native form controls.
If you’re looking for an accessible standalone autocomplete script, this one from GDS looks very good (similar to Lea’s awesomplete).