Skip to content

Commit

Permalink
add disposable listener
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Jan 10, 2025
1 parent babc379 commit 9a9d27e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/list/listView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export class ListView<T> implements IListView<T> {
}

private _setupFocusObserver(container: HTMLElement): void {
container.addEventListener('focus', () => {
addDisposableListener(container, 'focus', () => {
const element = getActiveElement() as HTMLElement | null;
if (this.activeElement !== element && element !== null) {
this.activeElement = element;
Expand All @@ -480,7 +480,7 @@ export class ListView<T> implements IListView<T> {

private _scrollToActiveElement(element: HTMLElement, container: HTMLElement) {
// The scroll event on the list only fires when scrolling down.
// If the active element is above the viewport, we need to scroll up.
// If the active element is above the viewport, we need to scroll up.
const containerRect = container.getBoundingClientRect();
const elementRect = element.getBoundingClientRect();

Expand Down

0 comments on commit 9a9d27e

Please sign in to comment.