Merge branch 'main' into web-run-polish
This commit is contained in:
+13
-6
@@ -1338,14 +1338,21 @@ export function mount(container, graph, options = {}) {
|
||||
selectNode(key, { notify: false });
|
||||
// The pane is still detached while the caller builds the detail, so reveal
|
||||
// it on the next frame, once renderContent has put it in the document. The
|
||||
// sticky top bar must stay clear of the pane head: scroll to the pane's top
|
||||
// minus the bar's own measured height (CSS scroll-margin-top is the
|
||||
// fallback for browsers that reveal it another way).
|
||||
// detail's own `.pane-scroll` is the only scroller in the shell: move it,
|
||||
// never the never-scrolling document.
|
||||
const reveal = () => {
|
||||
if (typeof pane.getBoundingClientRect !== "function") return;
|
||||
const topbar = document.querySelector(".topbar");
|
||||
const bar = topbar?.getBoundingClientRect?.().height ?? 0;
|
||||
const top = pane.getBoundingClientRect().top + (window.scrollY ?? 0) - bar - 12;
|
||||
const scroller = pane.closest(".pane-scroll");
|
||||
if (scroller) {
|
||||
const top =
|
||||
pane.getBoundingClientRect().top -
|
||||
scroller.getBoundingClientRect().top +
|
||||
scroller.scrollTop -
|
||||
12;
|
||||
scroller.scrollTop = Math.max(0, top);
|
||||
return;
|
||||
}
|
||||
const top = pane.getBoundingClientRect().top + (window.scrollY ?? 0) - 12;
|
||||
window.scrollTo?.({ top: Math.max(0, top), behavior: "instant" });
|
||||
};
|
||||
if (typeof requestAnimationFrame === "function") requestAnimationFrame(reveal);
|
||||
|
||||
Reference in New Issue
Block a user