HACKER Q&A
📣 forgotmypw17

How to communicate voting button state for screenreaders?


I'm working on several pages with "items", and each item has a "voting button". When the button is pressed, it adds one vote to the item's score, and reflects this to the user by incrementing the counter by one. So "like(1)" becomes "like(2)" and then "like(2)".

However, it seems to me like to someone using a screen-reader, it may not be accessible, meaning they won't understand what happened.

Does anyone know the proper way to handle this? Should I insert an aria alert element to the page, next to the voting button?


  👤 wittjeff Accepted Answer ✓
Add aria-presses attribute to show the like/don't like state as aria-pressed="true" or aria-pressed="false". You could also add aria-live="polite" to make the label be announced again when it is updated.