It’s not trivial, but nor is it as hard as lots of things browsers do. The issues are
- If you add everything with a title, but that wasn’t focusable, into the tab order, users might not be best pleased.
- Where to put the tooltip.
For users who can only navigate with a tab key, a lot of pages already have too much stuff in them and take a stupid amount of time to work. This is why old Opera, and screen readers, generally have extra navigation paths. But for keyboard-only users without a screenreader that doesn’t help, you just gave them more work.
When you focus something with a keyboard, any tooltip should not cover the bit you are looking at. But it should be near the start, since you might have a title on the
main element… This isn’t an insoluble problem, but will take designers some thinking time. When the tooltip follows the mouse cursor it’s easier to move out of the way…
I wonder whether the details element - used in reverse, as it were, so that on expanding it actually provides a summary of the thing it’s wrapping - is a better path forward. I mean something like
Select a date or enter in YYYY-MMM-dd format
Not that details is implemented a lot better in terms of accessibility, but it does allow you to deal with a lot of the problems @r12a talked about.
It doesn’t offer much in the way of styling though