Skip to content

LG-12595 Fix Selfie Screenreader Behavior by adding <FullScreen />#10228

Merged
charleyf merged 17 commits intomainfrom
charley/lg-12595-add-fullscreen-wrapper-to-selfie
Mar 14, 2024
Merged

LG-12595 Fix Selfie Screenreader Behavior by adding <FullScreen />#10228
charleyf merged 17 commits intomainfrom
charley/lg-12595-add-fullscreen-wrapper-to-selfie

Conversation

@charleyf
Copy link
Contributor

@charleyf charleyf commented Mar 11, 2024

🎫 Ticket

https://cm-jira.usa.gov/browse/LG-12595

🛠 Summary of changes

This PR wraps the selfie capture screen (where you see your face to take a pic) in a component to make it work with screenreaders. Before this PR, you could take a selfie, but trying to click the "retake" link button would not work correctly. The screenreader would start reading hidden content behind the capture window. With this PR the hidden content correctly remains unread.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Make sure Siri is on on your iPhone (sorry, but we need it)
  • Navigate to the front/back/selfie page on main branch.

Make sure you understand the problem:

  • Activate Siri (I long held the power button to do this)
  • Tell Siri "Turn on Voiceover", you should see a little settings tray appear and disappear.
  • Double tap on the selfie box to open selfie capture.
  • Take an image, this should work
  • ❌ Then try to retake, the screenreader will start to read hidden text.

Then see that this branch fixes the problem.

  • Now checkout this branch: charley/lg-12595-add-fullscreen-wrapper-to-selfie
  • Refresh the page, you should see the front/back/selfie page.
  • ✅ Open selfie again, this time the screenreader will read only the text visible on the page.
  • Activate Siri and tell it: "Turn off Voiceover" to get your controls back to normal.

@charleyf charleyf requested review from a team and night-jellyfish and removed request for a team March 11, 2024 18:54
@charleyf charleyf marked this pull request as ready for review March 11, 2024 19:03
Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

This looks good to me. Approved. 👍🏻

const button = queryByLabelText('account.navigation.close');

expect(button).to.not.exist();
// The button still exists, but without this class it doesn't show because the
Copy link
Contributor

Choose a reason for hiding this comment

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

Helpful comment. 👍🏻

type="button"
aria-label={t('account.navigation.close')}
onClick={onRequestClose}
className={hideCloseButton ? '' : 'full-screen__close-button usa-button padding-2 margin-2'}
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the comment above about z-index effectively hiding this button. Does that apply for screen readers as well? My concern is that someone using a screen reader could still find this button by navigating content, but the way we're implementing it seems to imply we don't want it to be available on the page.

I guess I'm not really following why we're making this change at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, thanks. Here's the "why" for this change:

  • This is currently the only place in the codebase where hideCloseButton is in use.
  • We don't want to show the close button (gray with an X icon) because it overlaps the "close" text in the top right corner and looks bad on the selfie capture screen.
  • If I try to use hideCloseButton as it's currently implemented in main, it does not work for selfie capture (see details below) because the Acuant "close" functionality appears after the focus trap is activated, which makes the focus trap error out.
  • This is my (inelegant) way of solving the problem of having two overlapping close functionalities and hiding the close button with the "X".

Other thoughts:

  • Thinking about this I realized that the hidden close button should continue to work, so I did this.
  • I'm open to other solutions, I couldn't come up with anything else that fit within a reasonable scope.

Details on why hideCloseButton doesn't work:

  • When I get to the front/back/selfie screen all is well.
  • But clicking on the selfie capture box does not open the selfie capture as expected.
  • Instead of opening selfie capture I get a console log from the focus-trap library that says something to the effect of "The focus trap needs to have a clickable element at all times".
  • I think that this is happening because there's some amount of time where the focus trap is active on acuant-face-capture-container but Acuant hasn't rendered in the close text yet.

Copy link
Contributor

@aduth aduth Mar 13, 2024

Choose a reason for hiding this comment

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

I guess one thing I'd want to have clarification on is: if we're intending to hide this, is it also hidden from assistive technology (screen reader)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another good point. I tried another approach with these last commits:

  • I reverted the changes to the fullscreen button (commit).
  • Instead, I'm doing the same thing that works for the Document capture - putting a button on the screen that we don't ever see, but would allow the user to close the screen (commit).

I think this is significantly better than the earlier idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that looks a lot better 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🚀 Thanks for all the comments! I really appreciate it.

Copy link
Contributor

@night-jellyfish night-jellyfish left a comment

Choose a reason for hiding this comment

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

Tested and saw the expected behavior. 🎉 Thanks for fixing this!

@charleyf charleyf merged commit 6e3a7c0 into main Mar 14, 2024
@charleyf charleyf deleted the charley/lg-12595-add-fullscreen-wrapper-to-selfie branch March 14, 2024 19:36
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.

5 participants