LG-15064: Countdown alerts for expiring phone OTP announces too frequently#11899
LG-15064: Countdown alerts for expiring phone OTP announces too frequently#11899
Conversation
changelog: Bug fixes, accessibility, slow down countdown frequency
23a9f9a to
e704197
Compare
| :tag_options | ||
|
|
||
| def initialize( | ||
| screen_reader_frequency: nil, |
There was a problem hiding this comment.
Rather than adding a new option here, did you consider using the approach that we use in the session timeout modal? Namely, having two separate countdowns, one of which is used for assistive technology announces at a slower interval:
identity-idp/app/views/session_timeout/_warning.html.erb
Lines 10 to 38 in 2b6458b
There was a problem hiding this comment.
I thought that I was going in this direction, but I am pivoting because I originally thought it was to use the one element.
| <%= render CountdownComponent.new( | ||
| expiration: Time.zone.now, | ||
| update_interval: 30.seconds, | ||
| start_immediately: true, |
There was a problem hiding this comment.
One thing we probably want to be conscious of here is that I don't know that we want the timer to start announcing "9 minutes and 30 seconds remaining" to a screen reader user, and for every 30 seconds thereafter. The alert component above is configured to only start counting down once it gets closer to the timeout (2m30s IIRC).
There was a problem hiding this comment.
Yeah the tricky thing that I think is happening is that we are dealing with two timers that need to tick at 2 different paces. Then when the banner shows up, it is counting down by the update_interval of one second while the countdown changes every 5 seconds. There has to be a way in which we silence the alert so that we only hear from the countdown, but I'm thinking of how to do that right now.
This feature works differently from the session timer because the popup shows once and the times are synced together.
|
|
||
| <p class="usa-sr-only" role="timer" aria-live="polite" aria-atomic="true"> | ||
| <%= render CountdownComponent.new( | ||
| expiration: Time.zone.now, |
There was a problem hiding this comment.
Not sure if this is temporary, but the expiration will need to be in the future matching @presenter.otp_expiration above.
…have space for countdown
…-idp into jd/LG-15064-countdown-timer
|
During testing, I found it interesting that the screen reader did not announce at the same time it appeared. It may be worth changing the expiration time on the countdown to match the banner. I don't think it is a good practice to have something visible for 30 seconds and after that 30 seconds is over, then the time is announced. |
|
What I attempted to do in 51a607e was to get the |
| document.body.innerHTML = ` | ||
| <lg-countdown-alert ${showAtRemaining ? `show-at-remaining="${showAtRemaining}"` : ''}> | ||
| <lg-countdown-alert ${showAtRemaining ? `show-at-remaining="${showAtRemaining}"` : ''} | ||
| }> |
There was a problem hiding this comment.
Is there a stray close curly brace here? It's not failing or anything but just wondering about the change.
There was a problem hiding this comment.
Yeah it looks like it was a stray. It was hard to discern because it was made to be text.
config/application.yml.default
Outdated
| max_mail_events: 2 | ||
| otp_delivery_blocklist_findtime: 1 | ||
| otp_delivery_blocklist_maxretry: 2 | ||
|
|
There was a problem hiding this comment.
Any reason for this break?
There was a problem hiding this comment.
ah, I had that change staged, but not committed. Fixed that in d261989
|
|
||
| class CountdownAlertComponent < BaseComponent | ||
| attr_reader :show_at_remaining, :alert_options, :countdown_options, :tag_options | ||
| attr_reader :show_at_remaining, :alert_options, :countdown_options, |
There was a problem hiding this comment.
Any reason for this change?
There was a problem hiding this comment.
That change was made by the linter. I don't think it needs to be linted in that way, so I will restore the change.
| include TwoFactorAuthenticatable | ||
| include MfaSetupConcern | ||
| include NewDeviceConcern | ||
| include SessionTimeoutWarningHelper |
There was a problem hiding this comment.
Are we using anything from that module?
| function createElement({ showAtRemaining }: { showAtRemaining?: number } = {}) { | ||
| document.body.innerHTML = ` | ||
| <lg-countdown-alert ${showAtRemaining ? `show-at-remaining="${showAtRemaining}"` : ''}> | ||
| <lg-countdown-alert ${showAtRemaining ? `show-at-remaining="${showAtRemaining}"` : ''} > |
There was a problem hiding this comment.
Minor, is the space before the '>' conventional?
There was a problem hiding this comment.
My mistake. Addressed this and your above comment in 64f1126
vrajmohan
left a comment
There was a problem hiding this comment.
Works as specified, looks good.
Co-authored-by: Andrew Duthie <1779930+aduth@users.noreply.github.com>
| @@ -1,4 +1,4 @@ | |||
| <%= tag.div(**tag_options, class: css_class, role:) do %> | |||
| <%= tag.div(role:, **tag_options, class: css_class) do %> | |||
There was a problem hiding this comment.
It'd be good to include some test coverage for this change, specifically that it's possible to override the default role with another value.
🎫 Ticket
Link to the relevant ticket:
LG-15064
🛠 Summary of changes
This ticket addresses a bug where the alert component announces the timer countdown every second. The alert will now announce once every 30 seconds.
📜 Testing Plan
otp_valid_forvalue for anything between 3-5 minutes to make testing more managable.Account creation
👀 Screenshots
finished.screen.recording.mov