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

show tooltip on icon label keyboard focus #199220

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/vs/base/browser/ui/iconLabel/iconLabelHover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTM
hoverPreparation = toDispose;
};
const mouseOverDomEmitter = dom.addDisposableListener(htmlElement, dom.EventType.MOUSE_OVER, onMouseOver, true);

const onFocus = () => {
if (hoverPreparation) {
return;
}
const target: IHoverDelegateTarget = {
targetElements: [htmlElement],
dispose: () => { }
};
const toDispose: DisposableStore = new DisposableStore();
meganrogge marked this conversation as resolved.
Show resolved Hide resolved
const onBlur = () => hideHover(true, true);
toDispose.add(dom.addDisposableListener(htmlElement, dom.EventType.BLUR, onBlur, true));
toDispose.add(triggerShowHover(hoverDelegate.delay, false, target));
hoverPreparation = toDispose;
};
const focusDomEmitter = dom.addDisposableListener(htmlElement, dom.EventType.FOCUS, onFocus, true);
const hover: ICustomHover = {
show: focus => {
hideHover(false, true); // terminate a ongoing mouse over preparation
Expand All @@ -233,6 +249,7 @@ export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTM
},
dispose: () => {
mouseOverDomEmitter.dispose();
focusDomEmitter.dispose();
hideHover(true, true);
}
};
Expand Down
Loading