An irresistible HTML element deep dive from Ire Aderinokun, this time on the
element for abbreviations. You can kinda just use it (JUI) and it works fine, but if you’re hoping to make a tooltip for them (which works on touchscreens as well), then it’s much more complicated.
I feel like this is the perfect sort of thing to be made into a web component that could/should be widely distributed for use. Maybe a
component or something. Can you have web components extend other native HTML elements though? If not, I guess it’s kinda falling back to what is essentially a
, so maybe that’s not ideal.
Dare I say it, this is also the kind of thing where React can excel. For example, I use Reach Router, and by default, when creating links (
s that turn into
s), they get the proper
aria-current attribute when it’s the current page. That’s good accessibility you’re getting for free because the library was good enough to get that detail right. As much as libraries like React get pointed at for problematic accessibility, there is a lot of potential for accessibility improvements through abstraction. Sort of like the way Brad Frost has been enforcing accessibility best practices in React components.
CSS Tricks Go to Source
Powered by WPeMatico