KEMBAR78
Create by default, but give dropdown for Preview on Github by justschen · Pull Request #257593 · microsoft/vscode · GitHub
Skip to content

Conversation

@justschen
Copy link
Collaborator

@justschen justschen commented Jul 24, 2025

@Yoyokrazy Yoyokrazy self-requested a review July 28, 2025 21:09
@Yoyokrazy Yoyokrazy marked this pull request as ready for review July 28, 2025 21:09
@vs-code-engineering
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@vs-code-engineering vs-code-engineering bot added this to the July 2025 milestone Jul 28, 2025
@osortega osortega modified the milestones: July 2025, August 2025 Aug 1, 2025
@Yoyokrazy Yoyokrazy marked this pull request as draft August 5, 2025 17:24
@Yoyokrazy Yoyokrazy assigned Yoyokrazy and unassigned justschen Aug 6, 2025
@Yoyokrazy Yoyokrazy removed their request for review August 6, 2025 18:48
@Yoyokrazy Yoyokrazy marked this pull request as ready for review August 13, 2025 21:18
@Yoyokrazy Yoyokrazy requested a review from bpasero August 13, 2025 21:18
@vs-code-engineering
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@Yoyokrazy
Copy link
Collaborator

@bpasero would appreciate a review on this one, since I had to make a small change or two to the contextmenuService. The issue was that without changing how we computed the anchor position, it would anchor itself well below the dropdown button when zoomed in, regardless of whether or not it was on screen.

The change was

const elementPosition = dom.getDomNodePagePosition(anchor);

to

const clientRect = anchor.getBoundingClientRect();
const elementPosition = { left: clientRect.left, top: clientRect.top, width: clientRect.width, height: clientRect.height };

I've checked as many context menus throughout the product as I could find, but not sure if there could be an edge case I'm missing.

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

@justschen @Yoyokrazy one thing to note is that we have a context menu implementation for browser that implements a similar logic, and now with this change the two implementations differ. The one for browser is:

const elementPosition = DOM.getDomNodePagePosition(anchor);

It is also possible for a user on desktop to enable custom context menus (something @benibenj added recently).

Can we see for a simpler fix if possible specifically for the zooming issue (which seems to be the real issue here) and/or understand if it impacts browser as well or differently?

@Yoyokrazy
Copy link
Collaborator

Yoyokrazy commented Aug 14, 2025

Can we see for a simpler fix if possible specifically for the zooming issue (which seems to be the real issue here) and/or understand if it impacts browser as well or differently?

@bpasero I'll see if there's any implications with browser, however I do want to clarify that it's actually not an issue with zoom. It's just an issue with where the button is positioned in the DOM vs the viewport. Zooming into the issue reporter just makes the issue more apparent since it pushes the button off the form.

To test this, I reverted all changes to the contextMenu service, and then changed the issue reporter window size from 700x800 to 700x300. Here's what we end up getting with how the context menu anchor is currently computed:

image

and then when I simply expand the issue reporter window manually, we can see that it was "correctly" anchored, just on the initial DOM position.

image

I'm not an expert with the front end work involved in a lot of the DOM structure and the differences with this and the browser implementation but I'll see if it's effected. Could be that we can bring this logic over to it as well, unsure. The clipping logic seems like something we could/should use regardless of how we want to get the anchor position (via either DOM.getDomNodePagePosition(anchor) or my proposed anchor.getBoundingClientRect(); + rect position/width/height)

Maybe the deeper issue is that the we don't recompute the anchor position as the window resizes. I know a lot of this code has been around for quite a while, so not sure how much relies on the nuance of the anchor hueristics we have right now.

I did notice that I couldn't really find any buttons with dropdowns that could be scrolled off the screen, so I wonder if this could've just been us exposing an edge case that we've never really had any reason to see until now.

@Yoyokrazy Yoyokrazy dismissed bpasero’s stale review August 26, 2025 17:53

browser layer fully tested via custom menu style

@vs-code-engineering
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@Yoyokrazy
Copy link
Collaborator

Tested all reporting action flows (preview + create) on native and custom context menus, windows + macOS as well. Changes to contextView and contextMenuService necessary now that we have a case where we can scroll a dropdown context menu off screen (calculations hadn't been built out to do viewport relative calculations and scroll offsets)

@Yoyokrazy Yoyokrazy changed the title dropdown in issue reporter to preview Create by default, but give dropdown for Preview on Github Aug 26, 2025
@Yoyokrazy Yoyokrazy merged commit d2ff8d1 into microsoft:main Aug 26, 2025
17 checks passed
osortega pushed a commit that referenced this pull request Aug 26, 2025
* dropdown in issue reporter to preview

* wip

* cleanup

* L/R padding for dropdown + preview by default

* some comment cleaning

* found the actual root fix. copilot wrote too much code.

* some cleanup

* preserve a comment

* fix cutoff rendering in the browser layer due to inner div dropping height css

* explanation

* wip -- race condition loading stylings?

* explanation of race condition, and gate the stylesheet behind the correct check

* fix not being able to scroll, and fix the custom browser contextmenu anchor math -- needs testing

* working -- needs cleanup + repo url appearing above button fix

* wip

* fix CSS for dropdown button

* polish

* cleanup

---------

Co-authored-by: Michael Lively <milively@microsoft.com>
@Yoyokrazy Yoyokrazy linked an issue Aug 28, 2025 that may be closed by this pull request
3 tasks
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue Reporter -- Add Create/Preview option + repo routing choices Issue Reporter no longer opens a draft issue

5 participants