fix(web): theme context menus on Windows and Linux #6440
ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/6440/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- @@ -36,4 +50,4 @@3650 items: readonly ContextMenuItem<T>[],3751 position?: { x: number; y: number },3852 ): Promise<T | null> => {39- if (window.desktopBridge) {53+ if (window.desktopBridge && isMacOSHost()) {
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/contextMenuFallback.ts lines 389 to 390Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -239,13 +363,12 @@239- ? "color-mix(in srgb, var(--destructive) 10%, transparent)"240- : "var(--accent)";241- button.style.color = isLeafDestructive242- ? "var(--destructive-foreground)"243- : "var(--accent-foreground)";363+ isHovered = true;364+ applyInteractionStyles();244365 });245366 button.addEventListener("mouseleave", () => {246- button.style.background = "transparent";247- button.style.color = isLeafDestructive248- ? "var(--destructive-foreground)"249- : "var(--foreground)";367+ isHovered = false;368+ applyInteractionStyles();250369 });251370371+ const openSubmenu = (shouldFocusFirst: boolean) => {372+ const rect = button.getBoundingClientRect();373+ button.setAttribute("aria-expanded", "true");374+ openMenu(item.children!, rect.right + 4, rect.top, level + 1, shouldFocusFirst, button);
- apps/web/src/contextMenuFallback.ts line 222Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -134,0 +186,21 @@186+ return;187+ }188+189+ const currentIndex = buttons.indexOf(button);190+ switch (event.key) {191+ case "ArrowDown":192+ event.preventDefault();193+ focusMenuItem(menu, currentIndex + 1);194+ break;195+ case "ArrowUp":196+ event.preventDefault();197+ focusMenuItem(menu, currentIndex - 1);198+ break;199+ case "Home":200+ event.preventDefault();201+ focusMenuItem(menu, 0);202+ break;203+ case "End":204+ event.preventDefault();205+ focusMenuItem(menu, buttons.length - 1);206+ break;apps/web/src/contextMenuFallback.ts line 159Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -128,3 +137,11 @@128137 resolve(result);129138 };130139140+ const closeMenusFromLevel = (level: number) => {141+ while (menuStack.length > level) {142+ const childLevel = menuStack.length - 1;143+ menuParentButtons[childLevel]?.setAttribute("aria-expanded", "false");144+ menuParentButtons.pop();145+ menuStack.pop()?.remove();146+ }147+ };apps/web/src/contextMenuFallback.ts line 285Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -172,3 +265,5 @@172265 menu.style.left = `${preferredLeft}px`;173266 menu.style.top = `${preferredTop}px`;174267 menu.dataset.level = String(level);268+ menu.setAttribute("role", "menu");269+ menu.setAttribute("aria-orientation", "vertical");
- apps/web/src/contextMenuFallback.ts line 220Resolvedby StiensWout(GitHub profile, opens in a new tab)@@ -134,0 +200,21 @@200+201+ const currentIndex = buttons.indexOf(button);202+ switch (event.key) {203+ case "ArrowDown":204+ event.preventDefault();205+ closeMenusFromLevel(menuIndex + 1);206+ focusMenuItem(menu, currentIndex + 1);207+ break;208+ case "ArrowUp":209+ event.preventDefault();210+ closeMenusFromLevel(menuIndex + 1);211+ focusMenuItem(menu, currentIndex - 1);212+ break;213+ case "Home":214+ event.preventDefault();215+ closeMenusFromLevel(menuIndex + 1);216+ focusMenuItem(menu, 0);217+ break;218+ case "End":219+ event.preventDefault();220+ closeMenusFromLevel(menuIndex + 1);
StiensWout(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.




Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
e532de4d-f06d-4a30-a2a3-82b1b3a685f1You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share