Skip to content

announce remaining time for test at certain times - #3092

Open
Alex-Jordan wants to merge 1 commit into
openwebwork:WeBWorK-2.21from
Alex-Jordan:aria-countdown
Open

announce remaining time for test at certain times#3092
Alex-Jordan wants to merge 1 commit into
openwebwork:WeBWorK-2.21from
Alex-Jordan:aria-countdown

Conversation

@Alex-Jordan

Copy link
Copy Markdown
Contributor

Even moreso than other recent PRs, this one could wait until after 2.21 is released and I'll retarget to develop. (That's true for all of these recent PRs, but this one seems like extra testing is warranted.)

An accessibility flag raised by Claude is that the countdown timer for a test is not announced. But of course we don't want it constantly announcing every tick of the clock. This makes it announce the timer at certain times. Those times are just what I came up with off the top of my head: at 1 second, 2 seconds, 3 seconds, 4 seconds, 5 seconds, 15 seconds, 30 seconds, 1 minute, 5 minutes, 15 minutes, 30 minutes, and every multiple of 30 minutes. Different times could be used.his

Also, this probably clashes with the existing thing where there is a dialog that pops up to warn you that you only have 45 seconds left, etc. So more thought should be put into something like this working well with that feature (which is a better feature for sighted users).

This should be tested with a screen reader, and I've never had much success trying that myself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually this is fine.

I am not hearing any of the announcements in testing with Gnome Orca. Furthermore, when in browse mode and navigating around the page with the arrow keys, now both of the timer divs are stopped at and announced. So you get repeated content.

With NVDA on Windows the announcements are made. The browse mode issue is the same, and both timer divs are stopped at and announced. Also, the last 5 seconds is not good. It announces "remaining time 5 seconds", then "remaining time 4 seconds", and by the time that is done the test is out of time. So the notification stating that pops up and it is read. Then it continues to read "remaining time 3 seconds", "remaining time 2 seconds", and "remaining time 1 second", meanwhile the timer on the screen is at 0 through all of that. I think that in the last five seconds the "remaining time" text will need to be removed so that it just reads "5 seconds", "4 seconds", ... Although I haven't tested that to see how well that works.

}

if (!timerDiv.dataset.acting) {
announceRemainingTime(remainingTime, forceAnnounce);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an empty line below this to offset it from the comment below it.

Comment on lines +67 to +71
t === 15 ||
t === 30 ||
t === 60 ||
t === 300 ||
t === 900 ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have frequently seen Claude miss many obvious things. This is one of them (unless this is your code). When I was not hearing any of the announcements, the first thing that I checked was that the text in the visually hidden div was actually changing, and I saw that it was not until it got down to 5 seconds or less. The === comparisons are not going to work. The remainingTime is not an integer. This is because the server time that is received in the updateTimeDelta method is not an integer (it is the submitTime for the request which is set using Time::HiRes). So the comparison t === 15 is highly unlikely to actually be true. So you will probably need to use something like (t >= 15 && t <= 16) instead. Either that or I suppose we could round the entire timeDelta value on line 168 instead of only the client time obtained from Date().getTime() / 1000, and then the === comparisons will work. I don't think that the sub second precision is needed.

Note that even when the div content is being set, the content is not announced (at least with Gnome Orca).

@drgrice1

Copy link
Copy Markdown
Member

Actually, I just noticed the browse mode issue is even worse, because the first timer div has the actual time, and the visually hidden time div sits at 1 minute until the 30 second mark.

Also, I think that there is going to need to be though about this in combination with the pop up alerts, because NVDA announces those also (Gnome Orca does not). So the last minute is filled with the time announcements, and it seems that would get really annoying if you are trying to work a test, and all of that is interrupting announcements of actual test content.

@drgrice1

Copy link
Copy Markdown
Member

Maybe the current notifications are enough, and just put aria hidden on the timer div? I think the count down at the end even would interfere with any last second effort you may be trying to make so much that you could not do anything useful.

So I think this pull request will need more thought in general.

@Alex-Jordan

Copy link
Copy Markdown
Contributor Author

Maybe the current notifications are enough, and just put aria hidden on the timer div?

Maybe. If you are not sighted, and you are curious how much time is left, is there a way to look? Of course, these announcements don't do that either. But if we have a solution that problem, then I think you might be right about just hiding the timer.

@drgrice1

Copy link
Copy Markdown
Member

That is true. So adding aria-hidden to the time div is not the solution. But I don't think that this approach of adding a second timer div that is also readable by an unsighted user and reads the wrong time most of the time is either.

@drgrice1

Copy link
Copy Markdown
Member

Would adding the aria-live and aria-atomic attributes momentarily to the existing div work to announce the remaining time at some intervals? Perhaps in the end, only the 5 second mark should be announced instead of attempting a count down?

@Alex-Jordan

Copy link
Copy Markdown
Contributor Author

This one will probably be closed. I'll see if I can circle back later today, but I have to step away from WW development for a while now (today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants