-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Conversation
if (!this.attachedContextDisposables.isDisposed) { | ||
this.attachedContextDisposables.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverElement, { trapFocus: false })); | ||
} |
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.
Does this mean attachments won't get hovers anymore?
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.
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 }); |
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.
Don't we still need to pass delegate 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.
Actually, it is not needed because the label already provides the default hover behaviour and tabs don't need any special hover behaviour
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