Re:Templating in HTML
by kitsunesoba on Tuesday October 04, 2022 @07:06PM
(#33088377)
Front end web is not my forte, but as I understand display:none; can have unintended (usually negative) interactions with screen readers, which I don't believe is a possibility with HTML templates.
[ Parent
| on HN ]
This is not true. I suspect it is a myth, I've heard it for decades now.
WebAIM[0]:
> display:none or visibility: hidden
> The content is removed from the visual flow of the page and is ignored by screen readers
[0] https://webaim.org/techniques/css/invisiblecontent/#techniqu...
Are you sure? It's my understanding that screen readers know to ignore elements with display:none;
There’s a way to hide from screen readers too if the OP was so inclined:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...
Re:Templating in HTML
by cantSpellSober on Tuesday October 04, 2022 @09:06PM
(#33089661)
display: none hides the content from screen readers, as it is not rendered.
aria-hidden is for elements that were rendered but are hidden (it's redundant on elements with a display value of `none`)