Closed owenatgov closed 2 years ago
As I'm investigating this, despite an effort to rework the 3xEsc key functionality, I'm finding that it doesn't work at all on firefox. There seems to be a push-pull of bugs between 3xEsc not working at all in firefox and it being very choppy or not working on pages across all browsers where the user has yet to interact with the page in a meaningful way. Will continue to investigate.
I've put together a testing sheet to record my findings.
span
on js initialisation with the attribute aria-live="polite"
and would update the text to update screen reader users of statusIn the above comment I mentioned that the 3xEsc feature wasn't working reliably. I believe it's in a reliable state now, however the reason I believe it was being unreliable and in some cases actively broken was because browsers were flagging the js as malicious code. I can't find any documentation or evidence for this so it's purely my speculation, although it wouldn't be surprising if browser vendors made a conscious choice not to document this for security reasons. A lot of what we're doing for Exit this Page risks making browsers "suspicious" even if we don't have any ill intent.
Parts of the code that browsers appear to take note of when determining if code is malicious or not:
window.location
via non traditional means such as a key event instead of a clickinnerText
of an elementThat latter one has meant that I've not been able to get the 3xEsc functionality working without abandoning the update on navigation.
I think the button press announcement needs content designing but don't think it's necessarily a derogatory feature. We could also consider expanding the key press timeout from 2 seconds.
The lack of ability to reliably announce button activation is problematic. We may have to weigh up the value of the 3xEsc feature vs activation announcement. I don't think it's critical that we announce button activation as it's a pattern in screen readers to not explicitly announce navigation.
The technical issue on adding listeners to links may have a negative impact on future feature investigations, most notably https://github.com/alphagov/govuk-design-system/issues/2389 which would be tied to button activation.
I've managed to get the 3xEsc feature to work reliably by switching the event listened for to trigger the behaviour via keyup
instead of keydown
. I'm not certain exactly if there's different weighting between the 2 events in terms of what counts as user interaction or of keydown
is already being used in browsers for something else.
I've therefore updated the testing sheet linked above with results on activating the button.
I think both an announcement that the esc key has been pressed and that the button has been activated have value. I think the latter far outweighs the former as we've identified that the time it takes to announce the message cuts into the key timer.
It's is an interesting challenge to balance informing the screenreader user what's going on vs their abuser not hearing it as they approach (and a similar one for voice input users too).
Some extra thoughts from a chat with @davidc-gds:
role="alert"
if your status update is important and/or time sensitivearia-live="polite"
might not be the right way to let the user know as it technically is time sensitive and important, however role="alert"
, especially when the user might be using the esc key for other things, might be stressful for the user if they're getting announced to a lotFor now I'm going to close this and we can assess the results of all the button behaviour spikes current in flow as one to see how they might impact each other and how to solve some of these lingering problems.
What
Investigate how best to communicate to screen reader users that they are interacting with the Exit this Page button. Specific questions we want to answer:
Epic: https://github.com/alphagov/govuk-design-system/issues/1755
Prototype: https://github.com/alphagov/govuk-frontend/pull/2545
Time limit: 1 week
Why
Following research on Exit this Page with users with access needs, we hypothesise that we need to better communicate the use of the button to screen reader users. However we're not confident about how much we should communicate to the user, how to communicate and if our current implementation hampers this.
Who needs to work on this
Developers, Accessibility specialists
Done when