Show HN: Hint.css v2.0 – Pure CSS tooltip library
kushagragour.in
kushagragour.in
This creates a pseudo ":after" element with content set to the value of the data-hint attribute. Smart!
Also checkout the pseudo counter: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_a...
Also, a good JS solution will dynamically reposition the tooltip if the requested orientation results in the tooltip being clipped by the viewport (eg. switch from right to left, top to bottom).
Edit: A quick test reveals these tooltips are not accessible at all.
Screen readers sometimes read out generated content. Léonie has more info: http://tink.uk/accessibility-support-for-css-generated-conte...
`aria-label` is essentially used twice here - both to populate the tooltip's contents, and to provide an accessibility label to the element that can be read off by a screen-reader.
I proposed these changes to the maintainers under an existing a11y issue (yay to people thinking about it!), but pointed out that if folks are using this library to supplement the contents of an element with a tooltip instead of labeling it, then the a11y changes are not ideal because a screen-reader will omit the element's contents in favor of whatever is inside the tooltip. My gut tells me that this library is mainly used to annotate things like icons.
Still worth fixing if possible, since many users browse at non-100% zoom.
This sounds dubious. Do you have a source for this?
Given there are tens of millions of people on the Internet, even if a small amount like 0,01% did it, it would already be "many people".
I would however appreciate some analytics data on it to have a better idea.
For anything with a higher DPI (including UHD/4k, but also lower resolutions), zoom is required to be able to read the text on most pages.
I run with 125% zoom on the 5+ year old iMac I use at work, and it makes a big difference.
If you'd like to see what size the fonts are with 100% zoom on a UHD monitor, try setting the zoom to 50%. You'll see.
I don't. However it seems odd to think people wouldn't zoom in a document viewer.
Let's get some real numbers though: I just asked Addy Osmani on Twitter if there are stats for this, since window.devicePixelRatio changes with zoom.
(I'm browsing Hacker News at 200% right now. It works great since their latest responsive fix.)
Chrome 48, Win 7
(After some messing around, it only appears at multiples of 75% zoom for me. I am using chrome 'Version 48.0.2564.97 m' on Windows with a 1080p screen.)
Chrome 47, Windows 8, ClearType enabled.
Well I guess everything is relative...
- Stylus or plain CSS
- Comes with a bit of JavaScript
- Auto-docks to browser window edges
- Multi-line if hint is too long
- Transitions> "Works in all modern browsers."
It'd be really helpful if you listed which browsers it's been tested to work in.
"hint.css works on all latest browsers, though the transition effect is supported only on IE10+, Chrome 26+ and FF4+ at present.
* Chrome - basic + transition effects
* Firefox - basic + transition effects
* Opera - basic
* Safari - basic
* IE 10+ - basic + transition effects
* IE 8 & 9 - basic"
[1] https://github.com/chinchang/hint.css#browser-supportHow to make it work on touch browser? Touch should trigger the <a href>, but I also like to see hints shows up somehow.