Merge pull request #20742 from Snuffleupagus/tree-viewer-scrollIntoView

Fix scrolling of outline item into view (PR 20495 follow-up)
This commit is contained in:
calixteman 2026-03-01 13:01:21 +01:00 committed by GitHub
commit 00d9d3a6ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,6 @@
import { removeNullCharacters } from "./ui_utils.js";
import { stopEvent } from "pdfjs-lib";
const TREEITEM_OFFSET_TOP = -100; // px
const TREEITEM_SELECTED_CLASS = "selected";
class BaseTreeViewer {
@ -185,10 +184,12 @@ class BaseTreeViewer {
this._updateCurrentTreeItem(treeItem);
this.container.scrollTo(
treeItem.offsetLeft,
treeItem.offsetTop + TREEITEM_OFFSET_TOP
);
treeItem.scrollIntoView({
behavior: "instant",
block: "center",
inline: "center",
container: "nearest",
});
}
}