-
Notifications
You must be signed in to change notification settings - Fork 166
LG-13363: Fix Screenreader Focus Jumping During Selfie Capture #10668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1da9e59
9b68c96
46aa113
749830c
dc44ede
468b795
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,16 @@ function AcuantSelfieCaptureCanvas({ imageCaptureText, onSelfieCaptureClosed }) | |
| // The Acuant SDK script AcuantPassiveLiveness attaches to whatever element has | ||
| // this id. It then uses that element as the root for the full screen selfie capture | ||
| const acuantCaptureContainerId = 'acuant-face-capture-container'; | ||
|
|
||
| // This solves a fairly nasty bug for screenreader users where the screenreader focus would jump away | ||
| // from the capture button (added by Acuant SDK) to the button in this component. Specifically we | ||
| // need to detect when Acuant actually hydrates in their capture screen and hide the button. | ||
| // See PR 10668 for more information. | ||
| const elementInShadow = document | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look for the camera container to see if Acuant has actually loaded their stuff onto the screen. Obviously inelegant, but does the job.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this update if Acuant becomes loaded? Are we expecting it to?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's what I think is happening:
The problem that this PR solves is that it lets me show the button on Step 3, and hide it on Step 4. Practically, what happens if you try to fully remove the button is you get an error about the FocusTrap always needing a tabbable element (which makes sense).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The primary concern I have here is that I don't see where we predictably expect React to re-render this component after the changes you describe.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A good point, the re-render isn't necessarily tied to this code in the way I want. We do re-render the |
||
| ?.getElementById('acuant-face-capture-camera') | ||
| ?.shadowRoot?.getElementById('cameraContainer'); | ||
| const loadedAcuantCamera = !!elementInShadow; | ||
|
|
||
| return ( | ||
| <> | ||
| {!isReady && <LoadingSpinner />} | ||
|
|
@@ -31,9 +41,11 @@ function AcuantSelfieCaptureCanvas({ imageCaptureText, onSelfieCaptureClosed }) | |
| )} | ||
| </p> | ||
| </div> | ||
| <button type="button" onClick={onSelfieCaptureClosed} className="usa-sr-only"> | ||
| {t('doc_auth.buttons.close')} | ||
| </button> | ||
| {!loadedAcuantCamera && ( | ||
| <button type="button" onClick={onSelfieCaptureClosed} className="usa-sr-only"> | ||
| {t('doc_auth.buttons.close')} | ||
| </button> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE: Test coverage @aduth. Unfortunately, we still do not have a way to actually get the Acuant SDK to start under any sort of testing conditions. It's a hole we've been aware of for a while, but it's pretty difficult to address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see code which expects a DOM element with a particular ID, and a state updater. I don't know that we need a full Acuant installation loaded to be able to test against that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test, which I think does a fairly good job showing how this functionality works.