3 ms·
> no simple standard CSS declaration to hide something from visible display but keep it for screenreaders ARIA attributes allow for that. https://developer.mo
by alberth 3y ago
> no simple standard CSS declaration to hide something from visible display but keep it for screenreaders
ARIA attributes allow for that.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...
Example code.
https://stackoverflow.com/questions/26032089/in-html-how-can-i-have-text-that-is-only-accessible-for-screen-readers-i-e-fo https://stackoverflow.com/questions/26032089/in-html-how-can...
- zerocrates 3y agoaria-label/labelledby is not always a workable solution. Sometimes you really need the text to be sitting there on the page as text for things to work right. Note that the very SO thread you linked to goes immediately to doing position/clipping tricks right after mentioning aria-label.
- darekkay 3y agoIn addition, aria labels don't work reliably with some HTML elements [1]. Specifically, the example from SO (div) will not work in some screen readers. [1] https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/ https://www.tpgi.com/short-note-on-aria-label-aria-labelledb...