Post

Fancy tooltips that use popover and anchor positioning are great. But sometimes all you need is a trustworthy title HTML attribute for a text-only tooltip. 😭 Only problem is: it can't be styled! Do you want these tooltips to be stylable? Maybe with a ::tooltip pseudo. Let me know your use cases!

5 reposts35 likes

I can't really imagine many use cases where you would need a tooltip on something that isn't focusable. I mostly use them when there's extra info or details to add to an action, a button... Something clickable

I've received a lot of responses and had really good discussions on this topic. I also did some additional research of my own. Still thinking about it, but will share back soon.

Thanks, you all, for your responses. I’ve had time to think more about this, read up more on the topic, and did some research. The result ➡️ Opening the can of tooltips, a blog post on our proposal to implement fully accessible and customizable built-in tooltips on the web.

patrickbrosset.comPatrick - Opening the can of tooltipsTooltips seem simple, until you look closer. The title attribute can't be styled and isn't accessible to everyone, while custom tooltips come with plenty of complexity. What would it take to build a n...

Solid research ! One thing though, you said tooltip should be linked to its trigger with aria-describedby. But that would s true only in some usages. When the tooltip add extra inform. But sometimes like when used on icon button it need to be the triggering element label.

I guess this would be nice for simple cases, but title tooltips have a too long hover delay, can’t be programmatically shown, and don’t support [non-interactive] HTML. So for most implementations, I’m still reaching for a component.

Most common case is probably icon buttons, as it gives users desktop more confidence in what they're about to click. My biggest gripe about title is a) style and b) show delay. Programmatic use cases and non-interactive HTML content can probably be handled fine with a popover, bth.

Yeah, that's where I draw the line too. Anything more complicated than a single line string probably works better with a popover. Thanks for the use case about icon buttons.

I’d settle for user-agent styles that didn’t look like they were from 1997! But yea, would be great to style tooltips/titles so they look integrated 🙇‍♂️

To be honest I should probably audit my usage of tooltips, but: - For info buttons (hiding and disclosing definitions). E.g what a webperf metric measures - Title attributes on links, buttons and other interactive elements That’s about it. I try to always use title when I can.

Yes, being able to style that way would be fantastic. Very in for less html and not needing to deal with positioning & accessibility work of rolling my own.

I tend to use them for both focusable and not. Typically focusable: - button - nav/menu item (<a>) Typically not focusable: - input labels - non-input labels - chart annotations - table content (headings, cells, etc.)

These and native form error messages. Not being able to change the font-size (through CSS and therefor also using CMD+PLUS) directly violates WCAG 1.4.4 (“text can be resized without assistive technology up to 200 percent without loss of content or functionality”). #A11Y