diff --git a/apps/web/src/providers/keyboard-shortcuts.tsx b/apps/web/src/providers/keyboard-shortcuts.tsx
index 089dea32..0c08a043 100644
--- a/apps/web/src/providers/keyboard-shortcuts.tsx
+++ b/apps/web/src/providers/keyboard-shortcuts.tsx
@@ -1,4 +1,5 @@
import type { ReactNode } from "react";
+import React from "react";
import {
Dialog,
DialogBackdrop,
@@ -464,19 +465,37 @@ function FormattedShortcut({ shortcut }: { shortcut: KeyboardShortcut }) {
? stroke.modifiers.map(stringifyModifier)
: [];
- modifierStrings.forEach((mod) => {
- parts.push({mod});
+ modifierStrings.forEach((mod, index) => {
+ parts.push(
+
+ {mod}
+ ,
+ );
});
- parts.push({stroke.key.toUpperCase()});
+ parts.push(
+
+ {stroke.key.toUpperCase()}
+ ,
+ );
return parts;
};
if (shortcut.type === "SEQUENCE") {
const parts: ReactNode[] = [];
- shortcut.strokes.forEach((stroke) => {
- parts.push(...formatStroke(stroke));
+ shortcut.strokes.forEach((stroke, strokeIndex) => {
+ const strokeParts = formatStroke(stroke);
+ // Add stroke index to keys to ensure uniqueness across multiple strokes
+ const keyedParts = strokeParts.map((part, partIndex) => {
+ if (React.isValidElement(part)) {
+ return React.cloneElement(part, {
+ key: `stroke-${strokeIndex}-${part.key || partIndex}`,
+ });
+ }
+ return part;
+ });
+ parts.push(...keyedParts);
});
return {parts};
}