r/reactjs • • Oct 12 '26

Accessability for timers in jaavscript React

So I have this code

<button
  type="button"
  className={styles.someclassname}
  tabIndex={-1}
  role="timer"
  aria-live="polite"
  aria-atomic="true"
>
  {ResendInfo (formatTimer())}
</button>

This is basically a countdown of a timer from 2 minutes I was wondering am I following proper accessability here so that screen readers can understand.

1 Upvotes

8 comments sorted by

8

u/azangru Oct 12 '26 • Popcorn

> I was wondering am I following proper accessability here so that screen readers can understand.

Have you tried checking this with a screen reader?

1

u/azangru Oct 12 '26

Here is someone's example that seems to work:

https://useragentman.com/enable/timer.php

0

u/[deleted] Oct 12 '26

[removed] — view removed comment

3

u/azangru Oct 12 '26

role="timer" isn't a thing, screen readers won't know what to do with it

Have you tried mdn?