Search code examples
htmlaccessibilitywai-ariajaws-screen-reader

JAWS / Web-Aim Is there any way to specify text as "a time" for screen readers?


If JAWS comes across a time in my page like so:

<div>
  <span>20:15</span> <!-- either of these times -->
  <span>04:15</span> <!-- either of these times -->
</div>

Then it reads them as "Twenty colon fifteen" which doesn't really sound like a time. Is there any way to specify that this is a time?

Maybe put text that is read but not seen by an average user as "Twenty colon fifteen o'clock" or something might be a viable answer.


Solution

  • Is there any way to specify that this is a time?

    HTML5 provides the time element and its datetime attribute.

    I can’t test if JAWS recognizes it, but it would be shame if it doesn’t (and they should certainly fix this).

    For the time "20:15", the markup could be:

    <time>20:15</time> 
    <!-- because "20:15" is a valid time string -->
    
    <time datetime="20:15">20:15</time>
    <!-- the datetime attribute is not needed here -->
    
    <time datetime="20:15">…</time>
    <!-- could have any content, as long as the datetime attribute contains a valid time string -->