From 09914b391f669c8afa32caa0880db800dc39c965 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 12 Jan 2024 13:08:29 +0530 Subject: [PATCH] Update index.js --- .../steps/SiteGen/Preview/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/OnboardingSPA/steps/SiteGen/Preview/index.js b/src/OnboardingSPA/steps/SiteGen/Preview/index.js index a102e5828..fc47d324c 100644 --- a/src/OnboardingSPA/steps/SiteGen/Preview/index.js +++ b/src/OnboardingSPA/steps/SiteGen/Preview/index.js @@ -93,6 +93,23 @@ const SiteGenPreview = () => { navigate( nextStep.path ); }; + const scrollSelectionIntoView = () => { + if ( + document.getElementsByClassName( + 'nfd-onboarding-step--site-gen__preview__note' + ) + ) { + document + .getElementsByClassName( + 'nfd-onboarding-step--site-gen__preview__note' + )[ 0 ] + .scrollIntoView( { + behavior: 'smooth', + block: 'end', + } ); + } + }; + const updateFavoriteStatus = ( slug, homepagesList ) => { homepagesList.forEach( ( homepageObj ) => { if ( homepageObj.slug === slug ) { @@ -131,6 +148,7 @@ const SiteGenPreview = () => { }; const handleRegenerate = async ( slug, colorPalattes, isFavourited ) => { + scrollSelectionIntoView(); setIsRegenerating( true ); if ( ! ( slug in homepages.data ) ) { if ( currentData.sitegen.siteDetails?.prompt !== '' ) {