fix: clamp Tools menu Y position to prevent overflow in non-maximized…#2901
Open
dudeabide21 wants to merge 3 commits into
Open
fix: clamp Tools menu Y position to prevent overflow in non-maximized…#2901dudeabide21 wants to merge 3 commits into
dudeabide21 wants to merge 3 commits into
Conversation
… windows - Prevent menu items from becoming unreachable on non-maximized windows - Detects screen bounds and estimates menu height based on item count - Clamps popup Y position to ensure menu stays within visible area - Fixes scroll arrow feedback loop that hides items like 'USB Stack' on RP2040 - Add defensive CSS overflow for additional safety (max-height + overflow-y: auto) - Works with multi-monitor setups - Keyboard navigation unaffected Fixes: arduino#2886
…text The previous fix imported Electron's screen API directly in a renderer-process file (electron-browser/), causing webpack to fail when bundling for the frontend because it can't resolve Node.js built-ins like 'fs' in browser context. Fix: replace Electron screen import with browser-native window.screen API which is safely available in the renderer process without any Node.js dependencies.
- Use 'unknown' type instead of MenuDto which required electron-common imports - electron-common can transitively import Node.js modules (fs, path, etc.) - These Node.js imports cause webpack to fail when bundling for browser - Defensive runtime checks ensure code works with any menu structure - window.screen API remains safe in renderer context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… windows
Fixes: #2886
Description
Fixes Tools menu items becoming unreachable when the IDE window is not maximized on Windows 11, particularly affecting boards with many Tools entries (e.g., RP2040 Pico core with USB Stack option).
Problem
When a board with many Tools menu entries is selected (e.g., Raspberry Pi Pico via Earle Philhower's RP2040 core), the Tools menu overflows the screen in a non-maximized window. The native Electron menu shows a scroll-up arrow but no scroll-down arrow. Hovering the scroll arrow causes a feedback loop — the menu repositions and hides the item the user is trying to reach (e.g., "USB Stack").
Video demonstrating the issue: https://youtu.be/eIT19Y_4sT0
Root Cause
The native Electron menu popup was positioned too low on screen, causing items to fall below the visible area. The OS scroll arrow interaction created a feedback loop that prevented reaching menu items.
Solution
Y Position Clamping in
electron-context-menu-renderer.ts:Defensive CSS Fallback in
browser-menu.css:Changes Made
arduino-ide-extension/src/electron-browser/theia/core/electron-context-menu-renderer.tsarduino-ide-extension/src/browser/style/browser-menu.cssTesting
Fixes #2886