Skip to content

fix: Tooltip shows trailing space for formatters without keyboard shortcut#1281

Open
deepak0x wants to merge 2 commits intoRocketChat:developfrom
deepak0x:fix/tooltip-shows-trailing-space-for-formatters-withou-0272
Open

fix: Tooltip shows trailing space for formatters without keyboard shortcut#1281
deepak0x wants to merge 2 commits intoRocketChat:developfrom
deepak0x:fix/tooltip-shows-trailing-space-for-formatters-withou-0272

Conversation

@deepak0x
Copy link
Copy Markdown
Contributor

@deepak0x deepak0x commented Apr 16, 2026

Fix Tooltip shows trailing space for formatters without keyboard shortcut

Acceptance Criteria fulfillment

  • Bug in packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js is fixed
  • Lint passes

Fixes #1280

Video/Screenshots

N/A - code-only change

PR Test Details

Tooltips for formatters without keyboard shortcuts were showing a trailing space. The bug is in packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js around line 219. The template literal builds the label like: item.name ${item.shortcut && (${item.shortcut})}. When there's no shortcut, that second part evaluates to an empty string. The space before it doesn't—so you end up with a dangling space in the tooltip.


Changes made:

  • Replaced "was showing" → "were showing" (direct observation from user perspective)
  • Replaced "The culprit was" → "The bug is" (simpler, more direct)
  • Replaced "renders... like this:" → "builds the label like:" (more conversational)
  • Replaced "When the shortcut is missing... but the space before it stays" → "When there's no shortcut... The space before it doesn't—so" (more natural rhythm, split into clearer parts)
  • Replaced "leaving a trailing space" → "you end up with a dangling space" (more human, acknowledges the observable effect)

…tcut

The template literal unconditionally included a space before the shortcut
expression, so formatters without a keyboard shortcut (strike, code,
multiline) rendered their tooltip as e.g. 'strike ' instead of 'strike'.

Replace with a ternary so the space and parentheses are only added when
a shortcut is present.
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.

bug: Tooltip shows trailing space for formatters without keyboard shortcut

1 participant