Skip to content

Commit

Permalink
Fix #151981. Avoid re-focus output when output already has focus. (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix authored Jul 13, 2022
1 parent 75e231a commit 18d4405
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,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 18d4405

Please sign in to comment.