Repository navigation
Focus the primary button in confirmation dialogs so Enter confirms - #5692
Merged
freescout-help-desk merged 1 commit intoOct 2, 2026
Conversation
Confirmation dialogs opened with showModalDialog() leave focus on the modal container, so Enter does nothing and Tab starts from the close button. Focus the primary button after the dialog body is inserted. Dialogs with a field to fill in (such as Delete User, which asks to type DELETE) are left as they are.
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.
Follow-up to #5683.
Problem
When a confirmation dialog opens (for example after pressing Delete on a conversation), focus stays on the dialog container. Enter does nothing, and Tab starts from the dialog's first focusable element. With #5683 the toolbar can be used from the keyboard, but every delete still needs the mouse, or several Tabs, to confirm.
To reproduce: open a conversation, focus the Delete icon and press Enter. The dialog opens, and pressing Enter again does nothing (
document.activeElementisdiv.modal).Fix
showModalDialog()now focuses the dialog's primary button once the body is in place, after anyon_showcallback has run:This covers every dialog opened through
showModalDialog()orshowModalConfirm(): deleting a conversation, bulk delete, discarding a draft, deleting a photo, resetting a password, and similar.Dialogs with a field to fill in are left as they are, so a dialog like Delete User, which asks you to type DELETE, can't be confirmed with a stray Enter.
Not changed
remote) are not affected.Tested
On
masterat 2f1739e, Chrome with real key events (CDPInput.dispatchKeyEvent):div.modaland Enter does nothing.The skip for dialogs with fields comes from the
input:visible,...check above. I read it against the Delete User dialog but did not drive that dialog in the test.Files
public/js/main.js:showModalDialog()