Skip to content

Commit bb9a4c3

Browse files
committed
fix(web): replace move to sidebar shortcut hotkey. attempt 2
1 parent 612f622 commit bb9a4c3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/web/src/views/Forms/EventForm/EventForm.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ export const EventForm: React.FC<FormProps> = ({
136136
onClose();
137137
};
138138

139-
const ignoreDelete = (e: KeyboardEvent) => {
139+
const handleIgnoredKeys = (e: KeyboardEvent) => {
140+
const ignore = (e: KeyboardEvent) => e.stopPropagation();
141+
140142
if (e.key === Key.Backspace) {
141-
e.stopPropagation();
143+
ignore(e);
144+
}
145+
146+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
147+
ignore(e);
142148
}
143149
};
144150

@@ -204,7 +210,7 @@ export const EventForm: React.FC<FormProps> = ({
204210
};
205211

206212
useHotkeys(
207-
"meta+[",
213+
"meta+k",
208214
() => {
209215
onConvert?.();
210216
},
@@ -272,7 +278,7 @@ export const EventForm: React.FC<FormProps> = ({
272278
<StyledTitle
273279
autoFocus
274280
onChange={onChangeEventTextField("title")}
275-
onKeyDown={ignoreDelete}
281+
onKeyDown={handleIgnoredKeys}
276282
placeholder="Title"
277283
role="textarea"
278284
name="Event Title"
@@ -294,7 +300,7 @@ export const EventForm: React.FC<FormProps> = ({
294300
<StyledDescription
295301
underlineColor={priorityColor}
296302
onChange={onChangeEventTextField("description")}
297-
onKeyDown={ignoreDelete}
303+
onKeyDown={handleIgnoredKeys}
298304
placeholder="Description"
299305
ref={descriptionRef}
300306
value={event.description || ""}

0 commit comments

Comments
 (0)