DEV Community

Discussion on: Star-rating using Unicode stars

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

This is great, just swap the opacity: 0.01 trick for a proper screen reader only class and maybe steal my text-shadow trick to give the stars a darker border (so contrast is high enough for a control at 3:1) and this gets an A++!

I actually think yours behaves better than mine too!

Have all of the ❤🦄 and bookmark love I can give!

Collapse
 
link2twenty profile image
Andrew Bone

I've made a slight edit, I use text-stroke though rather than the shadow trick.

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Oh I just noticed something else (minor tweak) your stars need to have aria-hidden=true instead of role=presentation as they are still screen reader accessible. Presentation basically says “this has no role” (think of it like turning it into a div or span if it was button for example) but doesn’t remove it from the accessibility tree. Not sure how I missed that!

Thread Thread
 
link2twenty profile image
Andrew Bone

Fixed