feat(web): confirm a scan delete and trap focus in modals - #677
Merged
Conversation
Deleting a scan removed its output folder on a single click, from both the scan table and the top-bar menu, and the files leave the disk with no copy kept. Both paths now go through a confirm dialog that names the scan, opens focus on Cancel, and reports the delete once it happens. The prompt comes from a shared Modal that owns the focus contract: focus enters the panel on open, Tab cycles inside it, Escape and a backdrop click close it, and focus returns to the control that opened it. FileViewer declared a focus trap in a comment but only handled Escape; it now uses the shared one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Deleting a scan asks for confirmation first. Both delete controls, the row
button in the scan table and the one in the top bar's scan menu, now park the
scan id and let the dialog make the call. The prompt names the scan, opens
focus on Cancel, and a confirmed delete raises a toast.
A shared Modal (components/ui/dialog.tsx) owns the focus contract: focus enters
the panel on open, Tab cycles inside it, Escape and a backdrop click close it,
and focus returns to the control that opened it. FileViewer documented a focus
trap but only handled Escape; it now uses the shared component. The wrap
arithmetic sits in lib/focus.ts as a pure function with unit tests.
There is no undo to offer: the server removes the output folder and keeps no
copy, which is why the guard goes in front of the action.
Verification
shell.spec.ts's existing delete test was updated to click through the new
confirm step.