-
Notifications
You must be signed in to change notification settings - Fork 37
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
STCOM-1387 ExportCSV download link not working in Modals #2400
Conversation
…the body to conform to possible focus-trapping
Quality Gate passedIssues Measures |
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.
Thank you, thank you for the clear explanation of the problem, its solution, and the attendant a11y concerns and mitigations. It's so helpful to have that extra context in the comments.
## [STCOM-1387](https://folio-org.atlassian.net/browse/STCOM-1387) The focus-trapping logic of Modal (via `focus-trap`) causes the `click()` event not to trigger on the download link rendered by `ExportCSV` because the link is appended outside of the focus-trapped element (in the body.) Approach: Rendering the link within the `div#OverlayContainer` places it in within the `focus-trapping` boundary. Since this element is always present in the stripes UI, it's okay to render here. For tests where the `OverlayContainer` may not exist, the logic falls back to the body. Additionally, the `exportCSV` logic would simply click the link and then remove it. This may not cause the focus to move, but it's a safe accessibility measure to return focus to the element it was originally on prior to clicking the download trigger. A similar fix is required in `stripes-util` since we're not sure how many ui modules use THAT version of `ExportCSV`... That PR: folio-org/stripes-util#91
The focus-trapping logic of Modal (via `focus-trap`) causes the `click()` event not to trigger on the download link rendered by `ExportCSV` because the link is appended outside of the focus-trapped element (in the body.) Approach: Rendering the link within the `div#OverlayContainer` places it in within the `focus-trapping` boundary. Since this element is always present in the stripes UI, it's okay to render here. For tests where the `OverlayContainer` may not exist, the logic falls back to the body. Additionally, the `exportCSV` logic would simply click the link and then remove it. This may not cause the focus to move, but it's a safe accessibility measure to return focus to the element it was originally on prior to clicking the download trigger. A similar fix is required in `stripes-util` since we're not sure how many ui modules use THAT version of `ExportCSV`... That PR: folio-org/stripes-util#91 (cherry picked from commit 45756bb)
STCOM-1387
The focus-trapping logic of Modal (via
focus-trap
) causes theclick()
event not to trigger on the download link rendered byExportCSV
because the link is appended outside of the focus-trapped element (in the body.)Approach:
Rendering the link within the
div#OverlayContainer
places it in within thefocus-trapping
boundary. Since this element is always present in the stripes UI, it's okay to render here. For tests where theOverlayContainer
may not exist, the logic falls back to the body.Additionally, the
exportCSV
logic would simply click the link and then remove it. This may not cause the focus to move, but it's a safe accessibility measure to return focus to the element it was originally on prior to clicking the download trigger.A similar fix is required in
stripes-util
since we're not sure how many ui modules use THAT version ofExportCSV
... That PR: folio-org/stripes-util#91