Skip to content

Fix app menu opening at cursor position instead of button position on touch#2760

Merged
wojtekn merged 2 commits intotrunkfrom
fix-app-menu-touch-position
Mar 16, 2026
Merged

Fix app menu opening at cursor position instead of button position on touch#2760
wojtekn merged 2 commits intotrunkfrom
fix-app-menu-touch-position

Conversation

@wojtekn
Copy link
Copy Markdown
Contributor

@wojtekn wojtekn commented Mar 11, 2026

Related issues

How AI was used in this PR

This PR was generated with Claude Code. I reviewed the code and the fix is correct.

Proposed Changes

  • Pass the menu button's bounding rect position (x, y) to menu.popup() so the context menu always opens anchored to the bottom-left of the button, regardless of where the touch/cursor lands
  • Without coordinates, Electron positions the menu at the current cursor location, which on touch differs from the button's visual position

Testing Instructions

  • On a Windows touch device, tap the Studio menu icon (hamburger) in the title bar
  • The context menu should open at the menu button, not at the touch point

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wojtekn wojtekn self-assigned this Mar 11, 2026
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Mar 11, 2026

📊 Performance Test Results

Comparing 063a1c1 vs trunk

site-editor

Metric trunk 063a1c1 Diff Change
load 1776.00 ms 1760.00 ms -16.00 ms ⚪ 0.0%

site-startup

Metric trunk 063a1c1 Diff Change
siteCreation 6081.00 ms 6119.00 ms +38.00 ms ⚪ 0.0%
siteStartup 3946.00 ms 3946.00 ms 0.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@wojtekn wojtekn requested a review from a team March 12, 2026 17:43
@wojtekn
Copy link
Copy Markdown
Contributor Author

wojtekn commented Mar 12, 2026

I tested this PR on a Windows machine with touch (Microsoft Surface), and menu is displayed in the correct position in all cases:

  • When I use the mouse and click the menu icon (most common case)
  • When I touch the menu icon while having the cursor outside Studio windows (this worked correctly before)
  • When I touch the menu icon while having the cursor somewhere over Studio (the case I'm fixing)

Copy link
Copy Markdown
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the right Windows device to test this but I wanted to mention that I tested on macOS and did not spot any regressions so far.

The fix makes sense but I will wait for maybe someone with the target device to give it another test.

@wojtekn
Copy link
Copy Markdown
Contributor Author

wojtekn commented Mar 13, 2026

The fix makes sense but I will wait for maybe someone with the target device to give it another test.

I think we can just test on any Windows machine to check for regressions. I already tested that on one with touch and confirmed it works fine.

Copy link
Copy Markdown
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it on Windows on Parallels. Even without touch, I think it makes sense to anchor the context menu to the button, not to the cursor position.

trunk this branch
Image Image

@wojtekn wojtekn merged commit 3475a7f into trunk Mar 16, 2026
10 checks passed
@wojtekn wojtekn deleted the fix-app-menu-touch-position branch March 16, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants