mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-17 20:44:27 +01:00
Fix list.focusPageUp movement with workbench.tree.enableStickyScroll (#202361)
fix #202288
This commit is contained in:
@@ -1762,9 +1762,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
async focusPreviousPage(browserEvent?: UIEvent, filter?: (element: T) => boolean): Promise<void> {
|
||||
async focusPreviousPage(browserEvent?: UIEvent, filter?: (element: T) => boolean, getPaddingTop: () => number = () => 0): Promise<void> {
|
||||
let firstPageIndex: number;
|
||||
const scrollTop = this.view.getScrollTop();
|
||||
const paddingTop = getPaddingTop();
|
||||
const scrollTop = this.view.getScrollTop() + paddingTop;
|
||||
|
||||
if (scrollTop === 0) {
|
||||
firstPageIndex = this.view.indexAt(scrollTop);
|
||||
@@ -1784,14 +1785,14 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
}
|
||||
} else {
|
||||
const previousScrollTop = scrollTop;
|
||||
this.view.setScrollTop(scrollTop - this.view.renderHeight);
|
||||
this.view.setScrollTop(scrollTop - this.view.renderHeight - paddingTop);
|
||||
|
||||
if (this.view.getScrollTop() !== previousScrollTop) {
|
||||
if (this.view.getScrollTop() + getPaddingTop() !== previousScrollTop) {
|
||||
this.setFocus([]);
|
||||
|
||||
// Let the scroll event listener run
|
||||
await timeout(0);
|
||||
await this.focusPreviousPage(browserEvent, filter);
|
||||
await this.focusPreviousPage(browserEvent, filter, getPaddingTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2880,7 +2880,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
||||
}
|
||||
|
||||
focusPreviousPage(browserEvent?: UIEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter): Promise<void> {
|
||||
return this.view.focusPreviousPage(browserEvent, filter);
|
||||
return this.view.focusPreviousPage(browserEvent, filter, () => this.stickyScrollController?.height ?? 0);
|
||||
}
|
||||
|
||||
focusLast(browserEvent?: UIEvent, filter = (isKeyboardEvent(browserEvent) && browserEvent.altKey) ? undefined : this.focusNavigationFilter): void {
|
||||
|
||||
Reference in New Issue
Block a user