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

Stripe appearance improvements #3795

Merged
merged 10 commits into from
Jan 30, 2025
Merged

Stripe appearance improvements #3795

merged 10 commits into from
Jan 30, 2025

Conversation

malithsen
Copy link
Contributor

@malithsen malithsen commented Jan 29, 2025

Fixes #3788, #3789

Changes proposed in this Pull Request:

This PR introduces a series of minor fixes to improve the visibility of Stripe payment fields.

  • Improve text visibility across light/dark themes
  • Improve label visibility on dark themes.
  • Use the site's background color in the Block element

With a light color palette

Before After
Block CleanShot 2025-01-29 at 10 50 24 CleanShot 2025-01-29 at 10 40 25
Shortcode CleanShot 2025-01-29 at 10 49 23 CleanShot 2025-01-29 at 10 40 52

With a dark color palette

Before After
Block CleanShot 2025-01-29 at 11 44 37 CleanShot 2025-01-29 at 11 34 49
Shortcode CleanShot 2025-01-29 at 11 44 09 CleanShot 2025-01-29 at 11 35 26

Testing instructions

  1. Clear out any appearance-related transients from the db (select * from wp_options where option_name like '%_appearance%')
  2. Update the site theme to use a light color palette.
  3. As a shopper, go to the checkout page and select the "Credit / Debit Card" payment method.
  4. All labels and text should be visible.
  5. Switch to Affirm payment method, inner area should match the site background color.
  6. Now customize the theme and change to a dark color palette.
  7. Clear out the appearance-related transients again (This step isn't necessary if Appearance: Updating the theme should immediately refresh Stripe styling data #3791 is fixed)
  8. Test the payment fields again for matching background and text visibility.

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

- Send background color to Stripe
- Fix text color
- Introduce style variables
We already have a global text color in variables. Use of label styles
for Text doesn't quite work for dark themes. So we remove the
customization here so that it uses default Stripe styles (gray text)
which looks good on both light/dark themes.
This time using paragraph rules instead of label rules
@malithsen malithsen requested review from a team and annemirasol and removed request for a team January 29, 2025 18:23
Comment on lines +415 to +419
'.Text': isColorLight( backgroundColor )
? darkParagraphRules
: paragraphRules,
'.Text--redirect': isColorLight( backgroundColor )
? darkParagraphRules
Copy link
Contributor Author

Choose a reason for hiding this comment

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

darkParagraphRules are obtained from the hidden input field. When using a dark palette, we use input text color for non-input text. This is a bit hacky but needed because, in shortcode checkout, there's always a light overlay. So, if we use paragraph rules, we will have light text on a light background.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see this for block checkout, 2025 theme. Is this expected?

Screenshot 2025-01-29 at 4 08 38 PM

Copy link
Contributor Author

@malithsen malithsen Jan 30, 2025

Choose a reason for hiding this comment

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

@annemirasol That doesn't look right. This is what I get
CleanShot 2025-01-29 at 19 37 20

Can you double-check the transients in the db to make sure it's not using the cached styles?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oof, you're right! I forgot to clear the transients in between switching palettes!

Copy link
Contributor

@annemirasol annemirasol left a comment

Choose a reason for hiding this comment

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

Everything looks great ✨ Thanks for the improvements! 🚢

@malithsen malithsen merged commit dee0523 into develop Jan 30, 2025
36 of 37 checks passed
@malithsen malithsen deleted the fix/appearance-fixes branch January 30, 2025 16:56
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.

Appearance: Block elements are not styled
2 participants