Skip to content

Fix issue with context menu behaviour when extending beyond the boundaries of the window #8279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2025

Conversation

imadx
Copy link
Contributor

@imadx imadx commented Apr 27, 2025

🧢 Changes

  • Updates the x,y positions for the context menu on setAlignByMouse to handle top/left alignments for the context menu
  • Checks the top position of the context menu when toggling the top or bottom alignment to prevent consistent toggling.

☕️ Reasoning

  • The alignment is ignored when right-clicking to open context menus.

🎫 Affected issues

Fixes: #7912

Copy link

vercel bot commented Apr 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 7:29am

Copy link

vercel bot commented Apr 27, 2025

@imadx is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

@imadx imadx changed the title fix context menu position Fix issue with context menu extending beyond the boundaries of the window Apr 27, 2025
@Byron
Copy link
Collaborator

Byron commented Apr 27, 2025

Thanks a lot for contributing!

I tried it the way I thought it should reproduce, but the issue remained unchanged on MacOS at least. Clicking on the ... button of a commit will show a context menu that grows up, and the context menu of the whole branch will always grow down, and with that easily become invisible towards the bottom of the window frame.

@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Apr 27, 2025
@imadx
Copy link
Contributor Author

imadx commented Apr 29, 2025

@Byron Do you have a screenshot that I can refer to regarding the recreated issue? Here’s what I’m seeing on my local build with the fix on my Mac.

image

@Byron
Copy link
Collaborator

Byron commented Apr 29, 2025

I think I get it now - the repositioning is working within the frame of the GitButler window.

What I tried is to put it against the Screen, assuming it would avoid going off-screen as well.
Screenshot 2025-04-29 at 18 47 39

Something that is unrelated, but just so it's documented and with CC to @estib-vega, I saw that the algorithm currently flip-flops if the vertical height isn't sufficient.

Screen.Recording.2025-04-29.at.18.48.24.mov

@Byron Byron removed the feedback requested Feedback was requested to help resolve the issue label Apr 29, 2025
@imadx imadx changed the title Fix issue with context menu extending beyond the boundaries of the window Fix issue with context menu behaviour when extending beyond the boundaries of the window May 1, 2025
@imadx
Copy link
Contributor Author

imadx commented May 1, 2025

I've updated the same PR to avoid constant toggling on the context menu as well, in the same PR, since they both relate to the alignment behaviour on context menu.

Copy link
Contributor

@estib-vega estib-vega left a comment

Choose a reason for hiding this comment

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

Very nice!

@estib-vega estib-vega merged commit 4b618b6 into gitbutlerapp:master May 2, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context menu can go outside of window
3 participants