Skip to content

Desktop: Fixes #9588: Rich Text Editor: Fix keyboard and plugin-opened context menus sometimes not displayed or have incorrect content #12076

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

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Apr 9, 2025

Summary

This pull request changes how context menu events are handled in the Rich Text Editor. Rather than determining the target element using Electron context-menu events, this is done with browser contextmenu events.

This change was originally intended to fix #12058. Unfortunately, it doesn't do so. However, it does resolve two similar issues:

  • Accessibility issue: Context menus opened from the keyboard didn't target the correct element. For example, the "Edit" action for code blocks couldn't be accessed from a keyboard-opened contextmenu unless the user also moved the mouse over the code block.
  • Mermaid issue: The mermaid download button opens the context menu by dispatching a contextmenu event. This does not trigger the Electron context-menu event. As a result, previously, no context menu was displayed. (Rich text editor: Mermaid diagram download button doesn't work #9588).

Testing

Testing plan (Fedora 41 Linux):

  1. Copy text.
  2. Create a new, empty note.
  3. Right-click.
  4. Verify that the context menu has "Paste" and "Paste as text" items.
  5. Click "paste".
  6. Verify that the text is pasted.
  7. Repeat steps 3-5 with a context menu opened from the keyboard (using shift-f10).
  8. Verify that the image is pasted.
  9. Open the code block dialog.
  10. Verify that the "Cut"/"Copy"/"Paste" context menu is shown for content within the dialog.
  11. Select everything and copy, using a context menu.
  12. Click "OK".
  13. Right-click on the code block and click "Edit".
  14. Close the code block dialog.
  15. Move the mouse away from the code block.
  16. Move keyboard focus to the code block.
  17. Press shift-f10 to open the context menu.
  18. Verify that the context menu includes an "Edit" option.
  19. Select and activate the "Edit" option.
  20. Dismiss the edit dialog.
  21. Add a misspelled word below the edit dialog.
  22. Right-click on it.
  23. Verify that the right-click menu includes spelling suggestions.
  24. Click on a spelling suggestion.
  25. Verify that the word is replaced with the suggestion.

…nus events are

handled in the Rich Text Editor
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Fixes #9588: Adjust how context menus events are handled in the Rich Text Editor Desktop: Fixes #9588: Rich Text Editor: Fix keyboard and plugin-opened context menus sometimes not displayed or have incorrect content Apr 9, 2025
@laurent22 laurent22 merged commit 600000a into laurent22:dev Apr 9, 2025
11 checks passed
@personalizedrefrigerator personalizedrefrigerator added the accessibility Related to accessibility label Apr 15, 2025
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.

2 participants