Skip to content
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

Desktop: Fixes #10815: Fix Enter key submits dialogs even if a button has focus #10814

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Aug 2, 2024

Summary

This pull request fixes several issues with the same underlying cause:

  • Pressing Enter after focusing the "OK" button in the "Create Notebook" dialog created 3 notebooks rather than just 1.
  • Pressing Enter when trying to edit a field in the Note Properties dialog closed the dialog and saved changes instead.
  • Similar issues where Enter is intended by the user to activate a button or link, but instead dismisses the dialog.

This commit causes Enter to only submit a dialog if the "OK" button or an input has focus. This does not affect how the Escape key is handled.

Fixes #10815.

Notes

  • In many dialogs ("add tag", "add profile", "add notebook", and "note properties" dialogs) either a text input or the "OK" button has the default focus. As such, in these cases, pressing Enter with the default item focused still submits the dialog.
  • This should not affect plugin dialogs.
    • Brief testing was done with the note diff plugin by opening its note chooser dialog, selecting a note such that the "OK" button is visible, and pressing Enter.

Testing plan

Manual testing (MacOS):

  1. Open the "share" dialog for a notebook.
  2. Enter a recipient's email and press tab to focus the "share" button.
  3. Press enter.
  4. Verify that the recipient is added to the recipient list without the dialog closing.
  5. Press escape.
  6. Verify that the dialog is now closed.
  7. Open the "New Notebook" dialog.
  8. Type a title.
  9. Press Enter.
  10. Verify that the new notebook has been created.
  11. Repeat steps 7-8.
  12. Navigate to the "OK" button with the Tab key.
  13. Press Enter.
  14. Verify that just one notebook is created.
  15. Create a new note.
  16. Open the "note properties" dialog.
  17. Use the tab key to navigate to the "Edit" button for "Location".
  18. Press Enter.
  19. Verify that an input is shown and that the dialog is still visible.
  20. Make a small change and press Enter.
  21. Verify that the dialog has closed.
  22. Re-open the dialog and verify that the change was saved.

… focused dismisses the dialog

This commit causes `Enter` to only submit a dialog if the "OK" button or
an input has focus.
@personalizedrefrigerator personalizedrefrigerator added the accessibility Related to accessibility label Aug 2, 2024
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Accessibility: Fix pressing Enter while any dialog button is focused dismisses the dialog Desktop: Accessibility: Fix Enter key dismisses dialogs even if a button has focus Aug 2, 2024
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Accessibility: Fix Enter key dismisses dialogs even if a button has focus Desktop: Fixes #10815: Fix Enter key submits dialogs even if a button has focus Aug 2, 2024
@laurent22 laurent22 merged commit 88271bf into laurent22:dev Aug 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Related to accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessibility: Creating a new notebook by pressing Enter after focusing the "OK" button creates 3 notebooks
2 participants