Skip to content

Commit 9800cf6

Browse files
authored
Merge pull request microsoft#189150 from microsoft/hediet/release-fix2
Fixes microsoft#188934 in release
2 parents d3e1105 + 089ad55 commit 9800cf6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/vs/editor/browser/widget/diffEditor.contribution.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,30 @@ export function findFocusedDiffEditor(accessor: ServicesAccessor): IDiffEditor |
9090
return diffEditor;
9191
}
9292
}
93+
94+
if (document.activeElement) {
95+
for (const d of diffEditors) {
96+
const container = d.getContainerDomNode();
97+
if (isElementOrParentOf(container, document.activeElement)) {
98+
return d;
99+
}
100+
}
101+
}
102+
93103
return null;
94104
}
95105

106+
function isElementOrParentOf(elementOrParent: Element, element: Element): boolean {
107+
let e: Element | null = element;
108+
while (e) {
109+
if (e === elementOrParent) {
110+
return true;
111+
}
112+
e = e.parentElement;
113+
}
114+
return false;
115+
}
116+
96117
CommandsRegistry.registerCommandAlias('editor.action.diffReview.next', AccessibleDiffViewerNext.id);
97118
registerAction2(AccessibleDiffViewerNext);
98119

0 commit comments

Comments
 (0)