Closed jeana-adhoc closed 11 months ago
Hey team! Please add your planning poker estimate with Zenhub @Andrew565 @ataker @harshil1793 @it-harrison @jamigibbs @micahchiang @nickjg231 @powellkerry @rmessina1010 @rsmithadhoc
Since opening this ticket, I discovered another issue with the modal. When the modal is closed, focus is lost. The keyboard seems to be below the button, but when you press tab, the phone number in the footer gets the focus indicator. However, if you just close the modal, the screen reader announces the Page
Here is a video
Currently modals use a "focusin" listener to detect when focus leaves the modal and enters the main body of a document. The Shadow DOM messes up the "focusin" listener, such that it doesn’t fire for anything inside of a Shadow DOM.
document.querySelector(“:focus”)
doesn’t track inside of the shadow DOM, making it difficult to programmatically detect which element is currently focused. Workaround has been to use event.composedPath()
and compare with a list of "focusableChidren", which 'double counts' the va-telephone
element and its enclosed a
tag. This has been used with the keydown
event, which works inside of Shadow DOM, but sequential focusing (using the tab key) prevents the .focus() method from working properly, so the focus ends up getting ‘stuck’ on the close button.
This article suggests using <dialog>
could work better, but:
(This was also posted to Slack, will update here when any decisions are made.)
The solution decided on was to attach 'focus' listeners to the modal-triggering buttons for the OMB Info and Crisis Line Modal components, which appears to work well enough for our needs.
After receiving more feedback from Ryan, the following work still needs to be done:
Because of these additional requirements, I adjusted the point estimate for this ticket from 3 to 5, and expect that it will carry over. CC @humancompanion-usds , @caw310, @micahchiang
Bug Report
What happened
In the 508 audit on form 21-10210, received this note from the 508 office regarding the OMB component.
I was able to recreate this in storybook. It never happens when you just tab. But when you shift+tab (reverse tab) the focus leaves the modal. If you try this on the regular modal component, the focus never leaves the modal itself.
What I expected to happen
The focus to never leave the modal
Reproducing
Steps to reproduce:
<title>
is read, and then it just starts reading down the page.Urgency
How urgent is this request? Please select the approriate option below and/or provide details
Details