Skip to content
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

Allow hover target override for resource labels #230101

Merged
merged 7 commits into from
Oct 7, 2024
Merged

Conversation

benibenj
Copy link
Contributor

@benibenj benibenj commented Sep 30, 2024

I have come across this a couple of times already where the area for which the hover is shown should depend on the parent container dimensions. For example with tabs the hover should not only show when the mouse is over the label but when hovering on the entire container.
Also, sometimes the tab inex is set on a parent element, but should trigger the hover on the label in the child element. This seems to be the case with chat attachments.

I've only seen this with resouce/icon labels which is why the fix is limited to these labels. I am open to other suggestions if you have any ideas how to solve this more generally for all hovers. Adding something to the hoverdelegate seems a bit weird as one hoverdelegate can be shared accross multiple hovers.

closes #229905

@benibenj benibenj self-assigned this Sep 30, 2024
@benibenj benibenj enabled auto-merge (squash) September 30, 2024 08:20
@vs-code-engineering vs-code-engineering bot added this to the October 2024 milestone Sep 30, 2024
Comment on lines -781 to -740
if (!this.attachedContextDisposables.isDisposed) {
this.attachedContextDisposables.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverElement, { trapFocus: false }));
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean attachments won't get hovers anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They do, as it is provided by the resource label. I had to add this initially to make sure that focusing an attachment would cause the hover to show because the focus index is on the parent element of the resource label which also has a hover. This is annoying, because even though there is already a hover on the child element, I had to create a hover on the parent element to make this work. This is why I would like to fix this with this PR or a different approach

@@ -815,7 +815,7 @@ export class MultiEditorTabsControl extends EditorTabsControl {
tabContainer.appendChild(tabBorderTopContainer);

// Tab Editor Label
const editorLabel = this.tabResourceLabels.create(tabContainer, { hoverDelegate: this.getHoverDelegate() });
const editorLabel = this.tabResourceLabels.create(tabContainer, { hoverTargetOverrride: tabContainer });
Copy link
Member

Choose a reason for hiding this comment

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

Don't we still need to pass delegate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it is not needed because the label already provides the default hover behaviour and tabs don't need any special hover behaviour

@benibenj benibenj merged commit ddd16fa into main Oct 7, 2024
8 checks passed
@benibenj benibenj deleted the benibenj/plastic-otter branch October 7, 2024 21:15
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.

Editor tab hover action is not reachable
3 participants