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

Inconsistent Admin Bar module styling between themes

Open aaemnnosttv opened this issue 7 years ago • 6 comments

Bug Description

The content displayed in Site Kit's admin bar varies in appearance when different themes are activated:

Twenty Nineteen

image

Twenty Twenty

image

This appears to be due to different relative font-size values applied to the <html> element by each theme. This value should be fixed on the admin bar app's element so that it doesn't inherit this relative sizing.


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

Acceptance criteria

  • Ensure that font sizing in the Site Kit admin bar menu content with the stats is consistent regardless of the theme currently used.

Implementation Brief

The problem is that the styles use rem units which are specifically relative to the value defined on the <html> element which often varies from theme to theme.

image

These are generally the right unit to use, but in our case we need our components to remain consistent between wp-admin and the admin bar displayed on the front end.

  • Update units used for font-sizing to use px units instead of rem
  • Adjust values if needed for consistency between wp-admin and front end rendering

Changelog entry

  • Ensure Site Kit admin bar content is styled independently from the current theme.

aaemnnosttv avatar Nov 21 '19 08:11 aaemnnosttv

Noticed this just earlier as well too. Let's fix it for next release.

felixarntz avatar Nov 21 '19 18:11 felixarntz

IB ✅

felixarntz avatar Nov 26 '19 09:11 felixarntz

@felixarntz after digging into this a bit, I'm realizing that using em as mentioned in the IB is going to work as well as I thought. Apparently em units are only relative to the parent element's font-size, it isn't inherited from ancestors like other rules (source).

After reaching out to a few of my colleagues, it seems that it's best to use absolute units instead, such as px. There are a few cases it seems where this should have been used anyways, such as other elements in the component (such as an arrow) where the size is fixed using px dimensions as well. For other cases where a component's style is shared with other areas and should remain more responsive (such as a datapoint), these can use fixed overrides for the admin bar specifically (assets/sass/components/adminbar/_googlesitekit-adminbar-overrides.scss).

Let me know if this is okay and I'll update the IB before continuing. Moving to blocked for now.

aaemnnosttv avatar Dec 04 '19 08:12 aaemnnosttv

@aaemnnosttv Using px sounds reasonable here. 👍

felixarntz avatar Dec 05 '19 15:12 felixarntz

Tested

Checked Swedish Museum: image

Twenty Seventeen: image

Twenty Nineteen image

Twenty Sixteen image

Astra: image

Hello: image

OceanWP: image

Looks good!

Passed QA ✅

cole10up avatar Dec 17 '19 16:12 cole10up

👁👍

marrrmarrr avatar Dec 17 '19 19:12 marrrmarrr