Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _wp-components-overrides.scss by increasing selector specifity #79708

Closed
wants to merge 9 commits into from

Conversation

alshakero
Copy link
Member

@alshakero alshakero commented Jul 20, 2023

Follow up to #79692.

This PR increases the selectors in wp-components-overrides in make wp.com styles take precedence over wp.org styles (that come from @wordpress/components.

This PR will fix all Stepper flows.

Testing

  1. Go to /setup/domain-transfer.
  2. Check the first two steps.
  3. The buttons should have blue-50 and should have good hover state.

  1. Go to /setup/link-in-bio.
  2. Check the second step.
  3. The buttons should have blue-50 and should have good hover state.

@github-actions
Copy link

github-actions bot commented Jul 20, 2023

@alshakero alshakero requested a review from renancarvalho July 20, 2023 20:24
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 20, 2023
@alshakero alshakero requested a review from mtias July 20, 2023 20:24
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

--wp-components-color-accent: var(--studio-blue-50);
--wp-components-color-accent-darker-20: var(--studio-blue-60);
--wp-components-color-accent-darker-10: var(--studio-blue-60);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done globally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this fix on Stepper level. It seems a couple of flows were affected by updating @wordpress/components.

p1689919222911329-slack-C05CT832K2T

@alshakero alshakero changed the title Domain Transfer: populate CSS variables to match the design Stepper: populate CSS variables to have WordPress.com colors (vs .orgs) Jul 21, 2023
Copy link
Contributor

@renancarvalho renancarvalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Omar, thank you for working on this one. Looks nice!

Besides the disabled state that you mentioned, I just missed the border radius 4px;

@alshakero
Copy link
Member Author

I just missed the border radius 4px;

Great catch, fixed.

@renancarvalho renancarvalho self-requested a review July 21, 2023 09:16
Copy link
Contributor

@renancarvalho renancarvalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@alshakero alshakero changed the title Stepper: populate CSS variables to have WordPress.com colors (vs .orgs) Fix _wp-components-overrides.scss by increasing selector specifity Jul 21, 2023
@noahtallen
Copy link
Contributor

noahtallen commented Jul 21, 2023

Thanks for fixing this! I noticed two issues in the link in bio flow:

Screen.Recording.2023-07-21.at.1.58.02.PM.mov
  1. The progress bar is misaligned (maybe unrelated to this PR)
  2. I think the hover color on the primary button is still using the WP color scheme, since it looks slightly purple. (might be wrong about this!)

opacity: 1;
}
justify-content: center;
border-radius: 4px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the border-radius change be done at the component level? Using button components in calypso shouldn't involve usage level CSS.

Maybe we need a new isLarge style option for the button component? height, font-weight, and border-radius could be done there. There is an isSmall prop already available.

@@ -11,14 +11,16 @@
}

/* @wordpress/components Button overrides */
.components-button {
a.components-button,
button.components-button {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we're missing a root cause here, why is adding this a fix?

As long as we're importing our overrides (this file) after the wordpress styles get imported (@wordpress/components/build-style/style), then we shouldn't need this change right?

I think what's happening is client/assets/stylesheets/style.css is being loaded into the stepper framework, where maybe previously it wasn't?

The client style.css file pulls in these lines:

@import "@wordpress/components/build-style/style";
// Overrides for @wordpress/components
@import "./wp-components-overrides";

Then later in the stepper framework pull in wordpress/component styles again here:

@import "@wordpress/components/build-style/style";

This overrides our overrides back with original styling.

I think the fix is to remove that line and then add our new overrides as required for wordpress/components in either the calypso-wide override file client/assets/stylesheets/_wp-components-overrides.scss or the stepper framework's client/landing/stepper/declarative-flow/internals/global.scss depending on which is more appropriate for the override.

I confirmed that if you remove that import line in global.scss and then add in the color overrides again:

// WordPress.org components no longer use blue-50 as the primary color.
// This changes the primary color to blue-50 to conform to the WordPress.com colors.
:root {
	--wp-components-color-accent: var(--studio-blue-50);
	--wp-components-color-accent-darker-20: var(--studio-blue-60);
	--wp-components-color-accent-darker-10: var(--studio-blue-60);
}

That the links have the right color in the link-in-bio flow.

We likely still need a new disabled button style added into the calypso-wide overrides file for a complete fix. Commented below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great investigation @lsl, I created a first version of this idea here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Louis! Much appreciated.

Comment on lines +417 to +421
button.components-button.bulk-domain-transfer__cta {
&:disabled {
background: var(--studio-gray-5);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this over to the wp-components-overrides file and generalize for all buttons? or if that's not an option right now at least into the stepper global.scss?

@paulopmt1
Copy link
Contributor

Thanks for your work here @alshakero. Based on it, I've created this follow-up task that fixed the style issue. So we can probably close this one.

@alshakero
Copy link
Member Author

I really really appreciate it! I was deep in other tasks.

@alshakero alshakero closed this Jul 28, 2023
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants