diff --git a/web/src/common.ts b/web/src/common.ts index 491f35cc18..2ad5cfc246 100644 --- a/web/src/common.ts +++ b/web/src/common.ts @@ -58,6 +58,14 @@ export function adjust_mac_kbd_tags(kbd_elem_class: string): void { const $kbd_elem = $("").text(following_key); $(this).after($("").text(" + ").contents(), $kbd_elem); } + + // The ⌘ symbol isn't vertically centered, so we use an icon. + if (key_text === "⌘") { + const $icon = $("") + .addClass("zulip-icon zulip-icon-mac-command") + .attr("aria-label", key_text); + $(this).empty().append($icon); // Use .append() to safely add the icon + } }); } diff --git a/web/styles/app_components.css b/web/styles/app_components.css index 9a4b429973..6cd9083c9b 100644 --- a/web/styles/app_components.css +++ b/web/styles/app_components.css @@ -32,10 +32,20 @@ kbd { background-color: var(--color-kbd-background); color: var(--color-kbd-text); margin: 0.25em 0.1em; - padding: 0.1em 0.4em; + padding: 0.2em 0.4em; text-shadow: 0 1px 0 hsl(0deg 0% 100%); /* Prevent selection */ user-select: none; + position: relative; + min-height: 1em; + min-width: 1em; + + .zulip-icon::before { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } } @media (width < $sm_min) {