From 35e34ee5d2ef218cd7191152b24f4c1181de98bb Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 3 Jan 2022 08:58:35 +0100 Subject: [PATCH] Switch to scrollHeight --- packages/notebook-extension/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index 4c1a2f569..5fc981860 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -254,14 +254,13 @@ const scrollOutput: JupyterFrontEndPlugin = { return; } const { node } = outputArea; - const height = node.getBoundingClientRect().height; + const height = node.scrollHeight; const fontSize = parseFloat(node.style.fontSize.replace('px', '')); const lineHeight = (fontSize || 14) * 1.3; // do not set via cell.outputScrolled = true, as this would // otherwise synchronize the scrolled state to the notebook metadata - if (height > lineHeight * autoScrollThreshold) { - cell.toggleClass(SCROLLED_OUTPUTS_CLASS, true); - } + const scroll = height > lineHeight * autoScrollThreshold; + cell.toggleClass(SCROLLED_OUTPUTS_CLASS, scroll); }; tracker.widgetAdded.connect((sender, notebook) => {