Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6b0cb75

Browse files
authored
Use kdb in space panel shortcut (#12525)
1 parent 667a754 commit 6b0cb75

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

res/css/structures/_SpacePanel.pcss

+7
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,10 @@ limitations under the License.
472472
.mx_SpacePanel_sharePublicSpace {
473473
margin: 0;
474474
}
475+
476+
.mx_SpacePanel_Tooltip_KeyboardShortcut {
477+
kbd {
478+
font-family: inherit;
479+
text-transform: capitalize;
480+
}
481+
}

src/accessibility/KeyboardShortcuts.ts

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export const KEY_ICON: Record<string, string> = {
203203
if (IS_MAC) {
204204
KEY_ICON[Key.META] = "⌘";
205205
KEY_ICON[Key.ALT] = "⌥";
206+
KEY_ICON[Key.SHIFT] = "⇧";
206207
}
207208

208209
export const CATEGORIES: Record<CategoryName, ICategory> = {

src/components/views/spaces/SpacePanel.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,16 @@ import QuickSettingsButton from "./QuickSettingsButton";
6262
import { useSettingValue } from "../../../hooks/useSettings";
6363
import UserMenu from "../../structures/UserMenu";
6464
import IndicatorScrollbar from "../../structures/IndicatorScrollbar";
65-
import { IS_MAC, Key } from "../../../Keyboard";
6665
import { useDispatcher } from "../../../hooks/useDispatcher";
6766
import defaultDispatcher from "../../../dispatcher/dispatcher";
6867
import { ActionPayload } from "../../../dispatcher/payloads";
6968
import { Action } from "../../../dispatcher/actions";
7069
import { NotificationState } from "../../../stores/notifications/NotificationState";
71-
import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts";
7270
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
7371
import { UIComponent } from "../../../settings/UIFeature";
7472
import { ThreadsActivityCentre } from "./threads-activity-centre/";
7573
import AccessibleButton from "../elements/AccessibleButton";
74+
import { KeyboardShortcut } from "../settings/KeyboardShortcut";
7675

7776
const useSpaces = (): [Room[], MetaSpace[], Room[], SpaceKey] => {
7877
const invites = useEventEmitterState<Room[]>(SpaceStore.instance, UPDATE_INVITED_SPACES, () => {
@@ -393,14 +392,11 @@ const SpacePanel: React.FC = () => {
393392
className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })}
394393
onClick={() => setPanelCollapsed(!isPanelCollapsed)}
395394
title={isPanelCollapsed ? _t("action|expand") : _t("action|collapse")}
396-
// TODO should use a kbd element for accessibility https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd
397395
caption={
398-
IS_MAC
399-
? "⌘ + ⇧ + D"
400-
: _t(ALTERNATE_KEY_NAME[Key.CONTROL]) +
401-
" + " +
402-
_t(ALTERNATE_KEY_NAME[Key.SHIFT]) +
403-
" + D"
396+
<KeyboardShortcut
397+
value={{ ctrlOrCmdKey: true, shiftKey: true, key: "d" }}
398+
className="mx_SpacePanel_Tooltip_KeyboardShortcut"
399+
/>
404400
}
405401
/>
406402
</UserMenu>

0 commit comments

Comments
 (0)