News for hackers. Stuff that matters.
Re:A Blog Post with Every HTML Element by zerocrates on Saturday August 12, 2023 @11:13PM (#37106339)
This comes up briefly but I do still find it ridiculous that there's no simple standard CSS declaration to hide something from visible display but keep it for screenreaders.

Everything I've seen still does clip, or positions the content off the side of the page, or something like that. How is this not just an alternative "display" value, or an additional property?

There's been a "speak" property floating around in one of those theoretical CSS modules that would accomplish this but as far as I know it has zero uptake among implementers.

Re:A Blog Post with Every HTML Element by alberth on Saturday August 12, 2023 @11:18PM (#37106366)
> 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/A...

Example code.

https://stackoverflow.com/questions/26032089/in-html-how-can...

Re:A Blog Post with Every HTML Element by zerocrates on Saturday August 12, 2023 @11:43PM (#37106482)
aria-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.

Re:A Blog Post with Every HTML Element by darekkay on Sunday August 13, 2023 @04:35AM (#37107876)
In 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-labelledb...

Re:A Blog Post with Every HTML Element by nine_k on Saturday August 12, 2023 @11:19PM (#37106370)
Why should it be a part of CSS, that handles visual representation, and not part of HTML, which handles data, structure, and semantics?

I wonder if a whitespace <div> with a right aria-label could fit the bill.

Re:A Blog Post with Every HTML Element by zerocrates on Saturday August 12, 2023 @11:38PM (#37106458)
CSS's display: none already affects what the screenreaders can "see." So it's already involved.
Re:A Blog Post with Every HTML Element by zamadatix on Sunday August 13, 2023 @10:28AM (#37110339)
And getting sick is a great reason you might use the phone to call into work but it doesn't imply getting sick is therefor the way to run all other phone usage through. I.e. it changes the behavior of the screen reader because it hides the content of the document and a screen reader knows it doesn't make sense to read content that was removed but that doesn't provide any support for why content which only affects screen readers belongs in the styling language as well.

Further point, in case you still disagree whether it makes sense for CSS to include the ability or not: CSS supports pseudo-elements but that doesn't mean tags in your page should be turned into pseudo-elements just because you can.

Re:A Blog Post with Every HTML Element by eismeer on Sunday August 13, 2023 @01:18AM (#37106916)
> I wonder if a whitespace <div> with a right aria-label could fit the bill.

Aria-label only works on interactive elements. I believe except the div has a `role`, screenreaders will ignore the label.