From 795546f71fe3dea3d2cc0d4e8b06b957ecc0ff48 Mon Sep 17 00:00:00 2001 From: Maximilian <787658+mfranzke@users.noreply.github.com> Date: Sun, 30 Jan 2022 15:31:56 +0100 Subject: [PATCH] chore: test for that method first of all --- .../src/scripts/components/modal-viewer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/uikit-workshop/src/scripts/components/modal-viewer.js b/packages/uikit-workshop/src/scripts/components/modal-viewer.js index d73ace6b2..edb505dee 100644 --- a/packages/uikit-workshop/src/scripts/components/modal-viewer.js +++ b/packages/uikit-workshop/src/scripts/components/modal-viewer.js @@ -230,10 +230,13 @@ export const modalViewer = { if (i + 1 === pos) { els[i].classList.add('pl-is-active'); - patternInfoPanelElem.scroll({ - top: els[i].offsetTop - 14, - behavior: 'smooth', - }); + // Scroll to the related entry withtin the pattern info panel + if (patternInfoElem.scroll) { + patternInfoElem.scroll({ + top: els[i].offsetTop - 14, + behavior: 'smooth', + }); + } } } },