Editor loses focus when you click or drag the window title bar (fixes #30967)
This commit is contained in:
parent
0d53acce8c
commit
d6bd346da2
1 changed files with 11 additions and 0 deletions
|
@ -265,6 +265,17 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
}
|
||||
});
|
||||
|
||||
// Since the title area is used to drag the window, we do not want to steal focus from the
|
||||
// currently active element. So we restore focus after a timeout back to where it was.
|
||||
this.titleContainer.on([DOM.EventType.MOUSE_DOWN], () => {
|
||||
const active = document.activeElement;
|
||||
setTimeout(() => {
|
||||
if (active instanceof HTMLElement) {
|
||||
active.focus();
|
||||
}
|
||||
}, 0 /* need a timeout because we are in capture phase */);
|
||||
}, void 0, true /* use capture to know the currently active element properly */);
|
||||
|
||||
return this.titleContainer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue