diff --git a/web/src/beta/features/Visualizer/Crust/StoryPanel/PanelContent/index.tsx b/web/src/beta/features/Visualizer/Crust/StoryPanel/PanelContent/index.tsx index 009562a567..70e60619cb 100644 --- a/web/src/beta/features/Visualizer/Crust/StoryPanel/PanelContent/index.tsx +++ b/web/src/beta/features/Visualizer/Crust/StoryPanel/PanelContent/index.tsx @@ -155,5 +155,5 @@ const PagesWrapper = styled("div")<{ })); const PageGap = styled("div")<{ height?: number }>(({ height }) => ({ - height: height ? `${height}px` : "70vh" + height: height ? `${height}px` : "70vh", })); diff --git a/web/src/beta/features/Visualizer/Crust/StoryPanel/hooks.ts b/web/src/beta/features/Visualizer/Crust/StoryPanel/hooks.ts index 1a206a0f82..1bedd95ea8 100644 --- a/web/src/beta/features/Visualizer/Crust/StoryPanel/hooks.ts +++ b/web/src/beta/features/Visualizer/Crust/StoryPanel/hooks.ts @@ -137,14 +137,22 @@ export default ( setCurrentPageId(newPage.id); setLayerOverride(undefined); + if (disableSelection) { + setDisableSelection(false); + setSelectedBlockId(undefined); + } + const container = document.getElementById(STORY_PANEL_CONTENT_ELEMENT_ID); if (!pageId) { - if (container) container.scrollTo(0, 0); // If no pageId, newPage will be the first page and we scroll all the way to the top here + if (container) container.scrollTo(0, 0); } else if (!disableScrollIntoView) { const element = document.getElementById(`story-page-${newPage.id}`); if (container && element) { isAutoScrolling.current = true; - container.scrollTo({ top: element?.offsetTop, behavior: "smooth" }); + container.scrollTo({ + top: element.offsetTop, + behavior: "smooth" + }); } } @@ -163,6 +171,7 @@ export default ( currentPageId, selectedStory?.pages, onStoryPageChange, + disableSelection, handlePageTime, visualizer ]