Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
Fix microsoft#151981. Avoid re-focus output when output already has f…
Browse files Browse the repository at this point in the history
…ocus. (microsoft#154991)
  • Loading branch information
rebornix authored and Michael Lively committed Jul 13, 2022
1 parent c6a2876 commit a841f66
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ async function webviewPreloads(ctx: PreloadContext) {
function focusFirstFocusableInCell(cellId: string) {
const cellOutputContainer = document.getElementById(cellId);
if (cellOutputContainer) {
if (cellOutputContainer.contains(document.activeElement)) {
return;
}

const focusableElement = cellOutputContainer.querySelector('[tabindex="0"], [href], button, input, option, select, textarea') as HTMLElement | null;
focusableElement?.focus();
}
Expand Down

0 comments on commit a841f66

Please sign in to comment.