primefaces / primeflex

PrimeFlex is a lightweight responsive CSS utility library to accompany Prime UI libraries and static webpages as well
https://www.primefaces.org/primeflex
MIT License
618 stars 191 forks source link

Screen Reader classes #157

Open LukMas opened 1 year ago

LukMas commented 1 year ago

Screen reader only classes

Having to work with impaired users sometimes we have the need to add extra text because the default, visible and read loud, is not enough for them. Other frameworks/libraries/etc... offer at the moment two classes that support the developers in this:

Visually hidden

This class is used to hide an element but show it to the screen reader. No hint about it is even shown, but the screen reader (or another similar technology) will read it as normal text.

Visually hidden and focusable

This class is a bit more evolved than the other one. By default the element is hidden but read from the screen reader. But, once it gets the focus, it becomes visible.

Suggestions and Links

chrisbratlien commented 2 days ago

I also need something like this on a project styled with primeflex.

My solution for now is to borrow this technique suggested by WebAIM:

https://webaim.org/techniques/css/invisiblecontent/

.sr-only {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}