site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Admin bar plugin settings inconsistent with others

Open aaemnnosttv opened this issue 5 years ago • 7 comments

Bug Description

In #990 we added a new control in the plugin settings for disabling the admin bar via a new setting.

This inconsistent with the existing opt-in setting for anonymous usage tracking which has been in Site Kit since the beginning.

  1. The fields are not aligned
    image
  2. The admin bar settings are not preloaded, resulting in an additional fetch request on page load

Steps to reproduce

  1. Go to Site Kit settings
  2. Refresh the page while observing network requests
  3. See request to core/site/data/admin-bar-settings
  4. Also notice settings fields are not aligned

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

Acceptance criteria

  • Admin bar settings should be preloaded to not invoke an immediate fetch request on page load
  • Plugin settings and tracking settings should visually align - specifically, the tracking setting style should be adjusted to align with the admin bar setting in left spacing.

Implementation Brief

  • Inside assets/sass/components/global/_googlesitekit-opt-in.scss:

    • Remove the rule on line 44 which adds the negative margin-left of 11px to the .mdc-checkbox
  • Inside includes/Core/Admin_Bar/Admin_Bar.php:

    • Inside the register method, add a filter for 'googlesitekit_apifetch_preload_paths' for the '/core/site/data/admin-bar-settings' REST path. See below for an example.

https://github.com/google/site-kit-wp/blob/ba9b9ed777c74f040e35351e4f69f37fe05a3ca8/includes/Core/Util/Tracking.php#L85-L95

Test Coverage

  • No new tests required; existing ones should pass.

Visual Regression Changes

  • VRT images dealing with the AdminBar checkbox may need updating.

QA Brief

  • In Settings page, Checkboxes should be aligned.
  • core/site/data/admin-bar-settings should be preloaded.
  • VRTs should pass.

Changelog entry

  • Update admin settings for consistency and introduce optional loading state for checkboxes.

aaemnnosttv avatar Sep 14 '21 20:09 aaemnnosttv

@felixarntz this is the issue I mentioned earlier today. Regarding the alignment, I think we should update the tracking input to be like the setting for the admin bar because the opt-in class has some special styles on it so that the checkbox border is left-aligned. This may be fine to keep in other places but in the general settings layout, it should probably be placed using default styles.

Does that sound good to you?

aaemnnosttv avatar Sep 15 '21 18:09 aaemnnosttv

@aaemnnosttv Sounds good to me - I've clarified this in the ACs.

felixarntz avatar Sep 15 '21 18:09 felixarntz

IB :heavy_check_mark:

eugene-manuilov avatar Sep 23 '21 16:09 eugene-manuilov

Following the IB and removing the negative margin from mdc-checkbox breaks design and VRT for Authenticate with Google Using GCP. Is this something we want to tackle in this Issue/IB Level?

Screenshot 2021-09-27 at 19-04-22 BackstopJS Report

CC @johnPhillips @eugene-manuilov @aaemnnosttv

kuasha420 avatar Sep 27 '21 13:09 kuasha420

@kuasha420 these are expected changes, so we need to approve them and add them to your PR. Run npm run test:visualtest and npm run test:visualapprove commands.

eugene-manuilov avatar Sep 27 '21 18:09 eugene-manuilov

QA Update: ✅

Verified:

  • In Settings page, the checkboxes are aligned.
  • Tested on all screen sizes including mobile and the checkboxes remain aligned.
  • Tested on supported browsers via Browserstack
  • Checked that core/site/data/admin-bar-settings is preloaded.

image

image

I have added the QA:Eng label for an engineer to check the VRT!

wpdarren avatar Sep 29 '21 11:09 wpdarren

QA:Eng ✅

Verified the following locally:

  • core/site/data/admin-bar-settings should be preloaded. ✅
  • VRTs should pass. ✅

johnPhillips avatar Sep 30 '21 13:09 johnPhillips