Skip to content

Commit 17ac0e7

Browse files
TonybynMp4claude
andcommitted
fix(web): drop duplicate menuitem attributes and keep modifier and IME guards in the menu key handler
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent 0e8824a commit 17ac0e7

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/web/src/contextMenuFallback.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ export function showContextMenuFallback<T extends string>(
306306
[...menu.querySelectorAll<HTMLButtonElement>("button")].filter((item) => !item.disabled);
307307

308308
const onKeyDown = (event: KeyboardEvent) => {
309+
if (
310+
event.defaultPrevented ||
311+
event.isComposing ||
312+
event.altKey ||
313+
event.ctrlKey ||
314+
event.metaKey
315+
)
316+
return;
309317
const level = menuStack.findIndex((menu) =>
310318
isNodeWithinMenuStack(document.activeElement, [menu]),
311319
);
@@ -463,8 +471,6 @@ export function showContextMenuFallback<T extends string>(
463471

464472
const button = document.createElement("button");
465473
button.type = "button";
466-
button.setAttribute("role", "menuitem");
467-
button.tabIndex = -1;
468474
button.dataset.label = item.label;
469475
const isDisabled = item.disabled === true;
470476
button.disabled = isDisabled;

0 commit comments

Comments
 (0)