Skip to content

Commit

Permalink
[Candidate] Fix #151981. Avoid re-focus output when output already ha…
Browse files Browse the repository at this point in the history
…s focus (#154999)

Fix #151981. Avoid re-focus output when output already has focus. (#154991)
  • Loading branch information
rebornix authored Jul 13, 2022
1 parent b7bf869 commit f8e5f9e
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 f8e5f9e

Please sign in to comment.