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: Resolves #5762: Rich Text Editor: Add eight spaces when pressing tab #10880

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Aug 16, 2024

Summary

This pull request adds the folllowing keyboard shortcuts to the Rich Text Editor:

  1. Tab: Adds eight nonbreaking spaces before the cursor.
    • Adds before the cursor: This is similar to how LibreOffice Writer handles the tab key — a tab character is inserted just before the cursor.
    • If in a list or table, the previous navigation/indentation behavior is preserved.
  2. Shift-Tab: Deletes up to eight spaces before the cursor.
    • If in a list or table, the previous navigation/indentation behavior is preserved.
  3. Escape, then Tab: Moves focus to the first item out of the Rich Text Editor. (Accessibility).
  4. Escape, then Shift-tab: Moves focus to the first item before the Rich Text Editor.

Why (nonbreaking) spaces?

  1. Logic already exists to convert repeated nonbreaking spaces to Markdown.
  2. Tab characters are treated as collapsible whitespace by default in HTML.

Resolves #5762.

Screen recording

Screencast.from.2024-08-15.19-40-55.webm

Testing

This pull request includes an automated Playwright test that verifies 1) Tab adds spaces in a paragraph, 2) shift-Tab removes spaces before the cursor, 3) Escape, then Tab moves the focus.

See the screen recording for manual testing information.

This is similar to how LibreOffice handles the tab key (though it uses
tabs and not spaces).
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Rich Text Editor: Add eight spaces when pressing tab Desktop: Resolves #5762: Rich Text Editor: Add eight spaces when pressing tab Aug 16, 2024
@laurent22 laurent22 merged commit b94cf5a into laurent22:dev Aug 17, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tab key does not create indentation in WYSIWYG editor instead it moves to tag section and so on.
2 participants