Keep keyboard focus after file upload and removal - #1351
dougchestnut wants to merge 2 commits into
Conversation
SweetAlert2 restored focus to a destroyed Remove button, which dropped focus to the document body. After upload or delete, move focus to the next logical control and announce the change.
|
I tested locally with success. |
|
Thanks for this — the happy path works well: removing a file and confirming now lands focus sensibly on the next file's Remove button (or back on the file input when none remain), which is a real improvement. Two behaviors introduced by the change regress the exact interaction it targets, though: 1. Cancelling the confirm dialog (or a failed delete) now strands keyboard focus on
Suggested fix: restore focus to the triggering Remove button on cancel/dismiss and on failed delete — or only pass 2. Multi-file uploads steal focus while the user is typing. Each completed upload unconditionally calls Two smaller notes in the same area:
🤖 Generated with Claude Code |
|
@dougchestnut, thank you for doing this work! Just flagging here that while I did have an agent generate the above comment I did run through and manually validate the concerns expressed therein. |
Keep returnFocus: false for a successful delete, but put keyboard focus back on the triggering Remove button when the confirm dialog is dismissed or the delete fails. After upload, only move focus if the user is still on the file picker. Clear the live region before each announcement and look up focus targets by id.
|
|
Thanks — good catches. Pushed a follow-up: cancel/failed delete restore focus to the Remove button, upload no longer steals focus if you're already typing a description, and the live region is cleared before each announcement. |



Summary
On the new-submission Files step, uploading or removing a file dropped keyboard focus (and could scroll the page to the top). Screen readers were not told that the file list changed.
returnFocus: false).aria-live="polite"region announces"<fileName> uploaded successfully."and"<fileName> removed.".Fixes eclipse-pass/main#1263
How to test
"<name> uploaded successfully.""<name> removed."#file-multiple-input). The page should not jump to the top.pnpm exec ember test --path dist --filter="workflow files"— 7 tests, including the three new focus cases.