RocketChat / RocketChat/Rocket.Chat
Formatting buttons and shortcuts should have the option to be toggles or apply only in message composer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
Pressing formatting buttons such as Bold, Italic, etc., or using their keyboard shortcuts, does not toggle the formatting. Instead, it keeps applying the format repeatedly, leading to incorrect text styling. This dosen't occur in Embedded Chat and popular markdown editors like github's editors.
Steps to Reproduce
- Open the message composer in Rocket.Chat.
- Type some text and select it.
- Click the Bold (
B) button or use the shortcut (Ctrl+B/Cmd+B). - Click the Bold button again or use the shortcut again.
- Observe that instead of removing the bold formatting, it keeps adding more asterisks (
****text****).
Expected Behavior
Pressing a formatting button (or using a shortcut) should toggle the formatting:
- If the selected text is already formatted (e.g., bold), clicking the button again should remove the formatting.
Actual Behavior
Instead of toggling the format, the button/shortcut keeps applying it, leading to unintended nested or duplicated formatting.
Server Setup Information
- Version of Rocket.Chat Server: 7.3.0-develop
Additional Context
This issue affects all formatting options like Bold, Italic, Code, Strikethrough, and others that require toggling behavior. Most markdown editors, including GitHub’s, follow a toggle behavior for formatting buttons and shortcuts.
For example, in GitHub’s editor, pressing Bold (Ctrl+B) once wraps the text, and pressing it again removes the formatting. Same is the case for Embedded Chat.
Rocket.Chat's current behavior is inconsistent with this standard, leading to unexpected formatting issues and general annoyance.
Steps To Fix
- Change the formatting buttons in the message composer to use toggle behaviour
- Change the formatting toolbar dropdown used in small screens to use toggle behaviour.
- Change the formatting shortcuts to use toggle behaviour.
- Add "Toggle markdown formatting" switch in /account/preferences under Messages preferences
- Add "Toggle markdown formatting" switch in admin/settings/Accounts under Default User Preferences to set a default value for new accounts.
Please let me add a PR. I have prepared one. This is my first issue btw. :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the repeated formatting behavior in the message composer, then inspect the formatting buttons, small-screen toolbar dropdown, and formatting shortcuts named in the issue. Review the Messages preferences under /account/preferences and the default user preferences under admin/settings/Accounts. Done means formatting toggles correctly across those entry points and the preference controls are available as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100