Skip to content

Add v-kbd component#27068

Merged
formfcw merged 7 commits intohugo/cms-1123-replace-custom-v-tooltip-with-reka-uifrom
hugo/cms-2090-create-v-kbd-component-for-keyboard-shortcut-display
Apr 17, 2026
Merged

Add v-kbd component#27068
formfcw merged 7 commits intohugo/cms-1123-replace-custom-v-tooltip-with-reka-uifrom
hugo/cms-2090-create-v-kbd-component-for-keyboard-shortcut-display

Conversation

@HZooly
Copy link
Copy Markdown
Member

@HZooly HZooly commented Apr 8, 2026

Scope

What's changed:

  • Add v-kbd component to display individual keyboard keys with platform-aware translation (e.g. meta on Mac, Ctrl on Windows), supporting three sizes and three visual variants (outlined, soft, inverted)
  • Add v-kbd-shortcut companion component that renders a sequence of v-kbd keys with consistent spacing, extending v-kbd's props interface
  • Register v-kbd as a global component
  • Replace all translateShortcut() plain-text usages in list item hints with VKbdShortcut — covers save-options.vue, item.vue, and input-rich-text-md.vue
  • Integrate v-kbd into the tooltip system via the kbd option on the v-tooltip directive, replacing inline string concatenation in toolbar buttons

Potential Risks / Drawbacks

  • translateShortcut is still used as a plain string in comparison-modal.vue and overlay-item.vue (JS logic, not template) — these are out of scope but leave the migration incomplete
  • app-tooltip.vue still renders individual VKbd in a v-for loop rather than using VKbdShortcut — minor inconsistency

Tested Scenarios

  • v-kbd renders the correct translated symbol for meta on Mac () and non-Mac (Ctrl)
  • Slot content takes precedence over the value prop
  • All size and variant props apply the correct CSS classes (covered by unit tests in v-kbd.test.ts)
  • v-kbd-shortcut renders multiple keys with gap spacing
  • Save options menu displays keyboard shortcut hints as styled key caps instead of plain text
  • Tooltip on markdown editor toolbar buttons shows VKbd-rendered shortcuts

Review Notes / Questions

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes #CMS-2090

@HZooly HZooly requested a review from AlexGaillard as a code owner April 8, 2026 12:13
@linear
Copy link
Copy Markdown

linear Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

@alvarosabu alvarosabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see this starting to take shape @HZooly, visually is ready from my side, but logic wise it need some iterations.

Happy to discuss

Comment thread app/src/components/v-kbd.vue
import { computed } from 'vue';

interface Props {
/** Keyboard key name to display, translated per platform (e.g. 'meta' → '⌘' on Mac) */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking:

The comment suggest that keys like meta would be translated on the specific operative system

<VKbd value="meta+s"></VKbd>

Should output ⌘S instead of META+S. You would need a composable like useKbd with navigator awareness

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v-kbd.vue is already using our composable translateShortcut.
Why your example is not working: v-kbd is responsible for displaying a single Kbd item.

<VKbd value="meta" />

If you want to display a set of keys, you have to use either VKbd multiple times

<VKbd value="meta" />
<VKbd value="S" />

or v-kbd-shortcut

<VKbdShortcut value="['meta', 's']" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the VKbdShortcut @HZooly great addition

@HZooly HZooly requested a review from alvarosabu April 13, 2026 14:33
Copy link
Copy Markdown
Contributor

@alvarosabu alvarosabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @HZooly great work!

@formfcw formfcw merged commit 7c3da7d into hugo/cms-1123-replace-custom-v-tooltip-with-reka-ui Apr 17, 2026
8 checks passed
@formfcw formfcw deleted the hugo/cms-2090-create-v-kbd-component-for-keyboard-shortcut-display branch April 17, 2026 18:18
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.

3 participants