google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 291 forks source link

Prevent flicker on AdSense, Analytics and Tag Manager setup screens. #6584

Closed techanvil closed 11 months ago

techanvil commented 1 year ago

Feature Description

When setting up the AdSense, Analytics and Tag Manager modules, a flicker can occur when saving the settings.

As seen here, when pressing Continue on the AdSense setup screen, the loading state momentarily reverts to the previous view.

https://user-images.githubusercontent.com/18395600/218533953-b53023f3-fa16-4a19-8274-c1129048e3ce.mp4

Note that a similar thing can occur when pressing Configure Analytics on the Analytics setup screen, or Confirm & Continue on the Tag Manager setup screen, however when attempting to screen grab these, the video didn't capture the flicker frames.

See this comment below for details on how we should address this.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Analytics Setup Form

In assets/js/modules/analytics/components/setup/SetupMain.js:

In assets/js/modules/analytics/components/setup/SetupForm.js:

AdSense Setup form

In assets/js/modules/adsense/components/setup/v2/common/SetupAccountSiteUI.js:

Note: This component will be moved from v2 directory once #4765 is merged.

Tag Manager Setup Form

In assets/js/modules/tagmanager/components/setup/SetupMain.js:

In assets/js/modules/tagmanager/components/setup/SetupForm.js:

Test Coverage

QA Brief

Changelog entry

aaemnnosttv commented 1 year ago

@techanvil I wonder if we should instead consider taking a similar approach as we have in other places lately where the component becomes ghosted/disabled with a spinner in the submit button? That seems like it would be a bit simpler and result in a more stable experience even if there was a "flicker" of state. Probably a question for UX but I think that would be preferable.

techanvil commented 1 year ago

Good question, @aaemnnosttv. I've moved this back to AC, tagging @sebastianmantel for UX input on this one...

techanvil commented 1 year ago

Update: Sigal has replied to the above question on the Slack UX channel as follows:

I took a look at the github issue and I agree with @aaemnnosttv that a spinner within the CTA button is preferable here as it appears before we change the view completely. The current loading state that flickers is suitable when displayed within the page that will actually load.

aaemnnosttv commented 11 months ago

AC LGTM 👍

techanvil commented 11 months ago

Hi @hussain-t, this IB is looking good.

One question - for the AdSense Setup form, instead of adding the new savingAdsenseSiteAdded state property, could we simply remove the checks for isDoingSubmitChanges and isNavigating from the condition for showing the ProgressBar in assets/js/modules/adsense/components/setup/utils.js? This would be preferable if so, but maybe you've explored this and it's not viable for some reason.

hussain-t commented 11 months ago

Hi @techanvil, thanks for your feedback.

I did consider removing the isDoingSubmitChanges and isNavigating checks from the condition; however, this approach led to an issue: clicking the Continue button in the SetupAccountApproved step quickly transitions to the next step, SetupSiteAdded, even while the form is still submitting. This results in the SetupSiteAdded button being disabled with an active spinner for a few seconds, which is not ideal for user experience. To avoid this, maintaining the ProgressBar during submission seems the most effective solution in SetupAccountApproved.

However, we don't need to modify the older Adsense setup form components due to the changes in 4765, which will phase them out. Please have a look at this PR.

I've updated the IB accordingly and reduced the estimate. LMK WDYT. Thanks!

techanvil commented 11 months ago

Thanks @hussain-t. That all being the case, this IB LGTM! :white_check_mark:

wpdarren commented 11 months ago

QA Update: ✅

Verified:

Note: I could not test the last task in the QAB as setting up Tag Manager with GA4 does not work. Confirmed this with Tom. I will create a new bug ticket for this.

Screencasts https://github.com/google/site-kit-wp/assets/73545194/882fb0e0-6c35-4aa0-91a8-b560f210aeb3 https://github.com/google/site-kit-wp/assets/73545194/c61cda1e-cb11-4776-a7f7-044241779fa3 https://github.com/google/site-kit-wp/assets/73545194/d6a09ff7-1403-4bdc-bbbb-8aceb03b8aeb