Skip to content

Commit 66bfc97

Browse files
committed
Addressed feedback microsoft#1
- reset CustomScrollbar._asyncInitTimer to undefined when it fires - made the deferred work in FocusManager idempotent
1 parent e6c6e50 commit 66bfc97

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/web/CustomScrollbar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ export class Scrollbar {
513513

514514
// Defer remaining init work to avoid triggering sync layout
515515
this._asyncInitTimer = window.setTimeout(() => {
516+
this._asyncInitTimer = undefined;
516517
this._tryLtrOverride();
517518
this.update();
518519
}, 0);

src/web/utils/FocusManager.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,15 @@ export class FocusManager extends FocusManagerBase {
161161
// back again.
162162
// Defer the work to avoid triggering sync layout.
163163
FocusManager._resetFocusTimer = setTimeout(() => {
164+
FocusManager._resetFocusTimer = undefined;
164165
const prevTabIndex = FocusManager._setTabIndex(document.body, 0);
166+
const activeElement = document.activeElement;
165167
document.body.focus();
166168
document.body.blur();
167169
FocusManager._setTabIndex(document.body, prevTabIndex);
170+
if (activeElement instanceof HTMLElement) {
171+
activeElement.focus();
172+
}
168173
}, 0);
169174
}
170175
}

0 commit comments

Comments
 (0)