civiform / civiform

CiviForm simplifies the application process for government benefits programs by re-using applicant data for multiple benefits applications. It's being developed by Google.org and Exygy, in collaboration with the City of Seattle and community contributors.
https://civiform.us
Apache License 2.0
98 stars 62 forks source link

[Multiple File Upload] When using keyboard controls, when uploading or removing a file, focus is lost #8719

Open devin-civi opened 1 month ago

devin-civi commented 1 month ago

This is very distracting to a screen reader user. To solve this we I'll probably add unique ids to all the "Remove" links, then when someone removes a file we'll return a URL containing the id for next/previous item in the list, or if none are in the list returns the ID for adding files. Similarly, when they add a file, we'll return the ID to add files (we could return the ID for the "remove" link for the just-added file, but that would jump them around in the page, so it's probably not the best).

devin-civi commented 2 weeks ago

Brainstorming with Melanie some possible fixes:

1- The fix I mention here, we'd have to embed this ID in a URL parameter, because it needs to survive the redirect that we do from add/Remove file to block edit. 2- Use local storage to do a similar trick (A bit weird, but doesn't require messing with our server side routes) 3 - Do something like 1 or 2, but simplify it to always the file upload widget (for both add and remove).

It doesn't seem possible to use hash tags in URLs for this because we do a redirect, that that removes the hash.

devin-civi commented 2 weeks ago

HTMX could also be used for the remove issue, but not for add. The reason being that the add ends up going through s3 servers, so every government would have to configure their servers to accept that AJAX call. Remove solely goes through our servers, so in theory could be done with HTMX.