Skip to content

fix: remove trailing space in formatting toolbar tooltips#1312

Open
yash113gadia wants to merge 1 commit into
RocketChat:developfrom
yash113gadia:fix/1280-tooltip-trailing-space
Open

fix: remove trailing space in formatting toolbar tooltips#1312
yash113gadia wants to merge 1 commit into
RocketChat:developfrom
yash113gadia:fix/1280-tooltip-trailing-space

Conversation

@yash113gadia
Copy link
Copy Markdown

Fix trailing space in formatting toolbar tooltips

Acceptance Criteria fulfillment

  • Tooltips for formatters with a shortcut still render as name (shortcut)
  • Tooltips for formatters without a shortcut (strike, code, multiline) render as just name — no trailing space
  • Fix applied to both the main toolbar and the small-screen toolbar

Fixes #1280

Description

The Tooltip text template literal in ChatInputFormattingToolbar.js unconditionally inserted a space between the formatter name and the optional shortcut:

text={`${item.name} ${item.shortcut && `(${item.shortcut})`}`}

When item.shortcut is an empty string (formatters like strike, code, multiline), item.shortcut && ... evaluates to '', but the leading space in the template was still included — so the tooltip rendered as "strike ", "code ", "multiline " with a trailing space.

The space is now part of the conditional, so it only appears when there is an actual shortcut:

text={`${item.name}${item.shortcut ? ` (${item.shortcut})` : ''}`}

The same pattern existed in the small-screen toolbar block, so it was fixed there too.

PR Test Details

  1. Open the chat input formatting toolbar.
  2. Hover the strike, code, and multiline buttons → tooltip shows the bare name, no trailing space.
  3. Hover bold / italic (which have shortcuts) → tooltip still shows name (shortcut).

Lint passes on the changed file (eslint clean; pre-existing unrelated warnings untouched).

The Tooltip text template literal unconditionally inserted a space
between the formatter name and the (optional) shortcut. For formatters
without a keyboard shortcut (strike, code, multiline), `item.shortcut`
is an empty string, so the tooltip rendered as "strike ", "code ",
"multiline " with a trailing space.

Made the space conditional so it only appears alongside an actual
shortcut. Applied to both the main toolbar and the small-screen toolbar.

Closes RocketChat#1280
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 31, 2026

CLA assistant check
All committers have signed the CLA.

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

2 participants