-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
prevent focus loss when chat code block toolbar dropdown More...
closes
#244990
base: main
Are you sure you want to change the base?
Conversation
@bpasero, do you have any insights here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem like the right approach. We have other instances of dropdowns that only show on hover and the issue does not apply there, notice how the "..." remains visible even when the menu shows:

I would suggest to review how other "..." entries are doing it, here for example the "..." in the "Repositories" view.

@bpasero , you are right. This works for all of the other consumers - just not the chat code block toolbar's dropdown. I found that commenting out this line (with no other changes) fixes it cc @roblourens vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css Lines 11 to 12 in ff02fe4
|
dec1734
to
ff02fe4
Compare
demo.mov |
0670a21
to
9e2787f
Compare
More...
menu closes for custom context menusMore...
menu closes chat code block toolbar dropdown
More...
menu closes chat code block toolbar dropdownMore...
closes
This looks nice, but can it be done without need for |
@bpasero that is necessary to fix this as I describe in the comment. |
But why do the other cases where we have this working not need to use |
The other cases do not hide the toolbar by default with display none, that removes it from the dom #244990 (comment) |
I would expect notebook cell toolbars to have the same problem (if you set |
@roblourens I tried using visibility and opacity and got the same result |
9532e10
to
53e995c
Compare
273eed0
to
9d6a2ae
Compare
edit: |
Megan and I talked about this today, the new change with |
AFAICT using display: none fully removes an element from the layout and accessibility tree, so when it’s made visible again, the browser needs a full frame to reflow and repaint before the element can receive focus—otherwise, .focus() may fail because the element isn’t yet interactable. In contrast, opacity: 0 keeps the element in the layout and accessibility tree, just visually hidden, so it can be focused immediately without waiting for a frame. |
We have this flag, For the current state, here's my interpretation
I think my PR is much simpler, but, there is a separate issue here which the opacity fix could also help with. I swear there's an old issue but I can't find it and I'm sure I never will. The issue is that the codeblock toolbar comes after the editor in the tab order, so that you tab from the editor to the toolbar. If we'd like it to be before the codeblock, we can probably move it in the DOM (I don't know why it's like that, maybe to make it show above), then the opacity trick lets me tab directly onto the toolbar before it's visible. Also the Anyway that was interesting, I'll let you decide how to go forward @meganrogge |
@roblourens thanks for investigating and explaining. Given using |
Sure, to be clear, it doesn't fix the other issue on its own, there would be another change to make there |
Since you're about to be out, and I have all of this stuff paged into memory now, how about I take over and look at that other tabbing issue? I assume that from an accessibility standpoint it would make sense, if I'm tabbing through the response, to first tab to the codeblock toolbar, then second tab into the codeblock itself right? |
I would think users would be annoyed with tabbing into a toolbar before tabbing into the code block bc they need to review the code block (ie tab into it) before deciding to take an action, if any. |
But yes, if you could pls take this over, that would be great. If you don't have time, maybe we should just fix the linked issue for now? |
Oh ok then maybe we did it this way because we actually prefer it this way. In that case, it also seems like it could be confusing to shift+tab backwards into a codeblock, and focus the toolbar before the codeblock (which we get by using opacity). But also skipping the toolbar entirely when tabbing backwards seems confusing too (current state). But I can just take it over. I'll probably merge both my PR and your opacity change. |
fixes https://github.com/microsoft/vscode-copilot/issues/9362
Fixing this as a priority today because will be out most of next week and this should've been fixed awhile ago. I thought it was invalid because had only tried on mac, where we use the native menu. It's an issue on windows and linux, where we use the custom context menu.
To test the fix on mac, I modified these lines so the custom context menu was used:
vscode/src/vs/workbench/services/contextmenu/electron-sandbox/contextmenuService.ts
Line 51 in f954362
Before:
demo2.mov
After:
demo.mov