Skip to content

[Enhancement]: Block-based checkout input fields style updates#46362

Merged
nielslange merged 27 commits intotrunkfrom
update/46008-checkout-input-fields-style
Jun 3, 2024
Merged

[Enhancement]: Block-based checkout input fields style updates#46362
nielslange merged 27 commits intotrunkfrom
update/46008-checkout-input-fields-style

Conversation

@nielslange
Copy link
Copy Markdown
Contributor

@nielslange nielslange commented Apr 9, 2024

Changes proposed in this Pull Request:

Closes #46008.

This PR introduces the following changes:

  1. Border and outline color adjustments:

    • Modified input fields (email address, country, order note, etc.) to use $universal-border-light as the outline/border color with a width of 1px when not focused.
    • Changed input fields to use $input-border-gray for the outline/border/box-shadow color with a width of 2px when focused.
  2. Field height and label text size adjustments:

    • Ensured that text input fields have a consistent height of 50px.
    • Updated the labels of text fields to use a font size of approximately 12px when the input field contains text (with a scaling factor of 0.75 when text is present).
  3. Dropdown chevron icon behavior:

    • Updated dropdown fields to display a down-facing chevron when closed.
    • Changed the chevron icon to an up-facing one when the dropdown is open.
  4. Inherit global colors:

    • Ensure that the input labels, values, and outlines inherit the color that if globally defined as the font color.
  5. Spacing adjustments for coupon code:

    • Added a top margin of 4px to the coupon code .wc-block-components-totals-discount__coupon-list.
    • Ensured that the top margin is consistent on both the cart and checkout pages.

Testing Instructions:

The testing instructions provided guide the tester through verifying each of these changes in detail, ensuring that the changes work as intended and that the UI behaves consistently when interacting with the updated elements.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions

Before all test cases

  1. Install and activate the Twenty Twenty-Four theme.
  2. Create a test page and add the Checkout block to it.
  3. Go to /wp-admin/edit.php?post_type=shop_coupon and create a test coupon.
  4. Go to the frontend.
  5. Add a product to the cart.
  6. Open the test page that contains the Checkout block.

Outline colors

Note

In this context, "outline" is used generically, though some elements may require adjustments to border or box-shadow properties. The term "outline" should be understood to impact all relevant elements uniformly. Follow these steps for verification:

  1. Click into the email address field.
  2. Verify that the text input fields (e.g., email address, country, order note) use $universal-border-light as the outline/border color and that the outline/border width is 1px.
  3. Individually select each text input field from the previous step.
  4. Verify that they use $input-border-gray for outline/border/box-shadow color, and that the outline/border/box-shadow width is 2px.
  5. Use both the mouse and keyboard to navigate and ensure the outline colors remain consistent when the fields are focused.
  6. Verify that the outlines of the radio input and checkboxes are consistent with the outlines of the text input fields → 1px when not being focued / 2px when being focued.
Before:

Screenshot 2024-05-22 at 15 17 42
After (default):

Screenshot 2024-05-22 at 15 02 56
After (focused):

Screenshot 2024-05-22 at 15 02 45

Field height and label text size

  1. Verify that the text input fields (email, address, coupon, etc.) have a height of 50px.
  2. Verify that the labels of the text fields use a font size of approximately 12px. (Note: When inspecting the label font size, 16.8px will be displayed, which is the size when the input field is empty. When the input field contains text, the label scales down by a factor of 0.75.)
Before:

Screenshot 2024-05-22 at 15 19 59
After:

Screenshot 2024-05-22 at 15 01 46

Dropdown chevron icon

  1. Look at the dropdown field, such as the country field.
  2. Verify that it shows a down-facing chevron when the dropdown field is closed.
  3. Open the dropdown field.
  4. Verify that it shows an up-facing chevron when the dropdown field is open.
Before:

Screenshot 2024-05-22 at 15 19 14
After (closed):

Screenshot 2024-05-27 at 11 54 03
After (opened):

Screenshot 2024-05-22 at 14 47 33

Inherit global colors

  1. Go to Apperance » Editor » Pages » Checkout.
  2. Open the styles sidebar in the upper-right corner.
  3. Click on Browse styles.
  4. Select the style Rust:
Screenshot 2024-06-03 at 13 39 24
  1. Verify that all input labels, values, and outlines appear in red. Checkboxes and radio buttons also appear in red, when being active or focused, and appear in grey otherwise.
  2. Look up the Checkout block in the frontend.
  3. Verify that all input labels, values, and outlines appear in red. Checkboxes and radio buttons also appear in red, when being active or focused, and appear in grey otherwise.
Screenshot 2024-06-03 at 13 49 32
  1. Go back to the site editor.
  2. Open the colors section and change the text color to #5E81AC.
  3. Verify that all input labels, values, and outlines appear in blue. Checkboxes and radio buttons also appear in blue, when being active or focused, and appear in grey otherwise.
  4. Look up the Checkout block in the frontend.
  5. Verify that all input labels, values, and outlines appear in blue. Checkboxes and radio buttons also appear in blue, when being active or focused, and appear in grey otherwise.
Screenshot 2024-06-03 at 13 51 41

Spacing between coupon title and coupon code

Note

The following fix was not part of the initial issue. However, due to its small scope, we decided to include it in this PR. This decision was agreed upon in this Slack discussion.

  1. Apply the coupon code.
  2. Verify that the coupon code .wc-block-components-totals-discount__coupon-list has a top margin of 4px.
  3. Go to the cart page.
  4. Verify that the coupon code also shows a top margin of 4px.
Before:

Screenshot 2024-05-22 at 15 20 45
After:

Screenshot 2024-05-22 at 14 43 33

Changelog entry

  • Automatically create a changelog entry from the details below.
Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@nielslange nielslange added the Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues label Apr 9, 2024
@nielslange nielslange self-assigned this Apr 9, 2024
@github-actions github-actions Bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 22, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@nielslange nielslange marked this pull request as ready for review May 24, 2024 14:24
@nielslange
Copy link
Copy Markdown
Contributor Author

Code looks good on this one and it tests well, the focus state looks much better, I think this will be a win for accessibility.

Yeah. That's great to hear! 🎉

I noticed that when selecting either of the delivery options (Ship or Local Pickup), they do not have the same focus state, so it would be good to add it there as well to keep consistent. It would be good to address that as part of this PR.

Thanks for pointing this out. I've adjusted this earlier.

I've also noticed that the input fields rendered by the payment methods (namely stripe and WooPayments with my setup) have different hover states. It would be good to align these with the rest of the checkout. /cc @nikkivias

This one might be a bit tricky to address, given that the Stripe input fields are within an iframe.

Your testing instructions are super detailed, and I appreciate the side notes explaining the outline and the font size change for the label. I think it would also be useful to add some brief testing steps for the checkbox and radio buttons as well here.

That's a good call. I'll update the testing instructions accordingly.

Copy link
Copy Markdown
Contributor

@alexflorisca alexflorisca left a comment

Choose a reason for hiding this comment

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

Thanks for the updates Niels, good shout about using the currentColor for focused elements! Good to go!

@nielslange
Copy link
Copy Markdown
Contributor Author

Thanks for reviewing and approving this PR, @alexflorisca! 🙌

@nielslange nielslange merged commit 93214ee into trunk Jun 3, 2024
@nielslange nielslange deleted the update/46008-checkout-input-fields-style branch June 3, 2024 11:46
@github-actions github-actions Bot added this to the 9.1.0 milestone Jun 3, 2024
@github-actions github-actions Bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Jun 3, 2024
samueljseay pushed a commit that referenced this pull request Jun 4, 2024
* Adjust border and box-shadow color for textual inputs

* WIP: Style checkboxes

* Vertically center checkmark

* Adjust focus outline width

* Adjust selected checkbox background in light mode

* Adjust background color of selected radio button

* Add chevron icon to dropdown fields

* Add changelog

* Fix CSS lint issues

* Adjust outline width

* Revert checkbox styles

* Adjust input field height and label size

* Revert box-shadow styles

* Add spacing between coupon title and coupon code

* Simplify onFocus and onBlur

* Fix outline width when focusing combobox

* Ensure chevron points down after selecting value

* Adjust outline color of focused delivery option

* POC: Use currentColor for focus states
@rodelgc rodelgc added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Jun 5, 2024
@juliaamosova juliaamosova added the release: highlight Issues that have a high user impact and need to be discussed/paid attention to. label Jun 27, 2024
@nielslange nielslange mentioned this pull request Jul 11, 2024
12 tasks
nielslange added a commit that referenced this pull request Jul 11, 2024
* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b879.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>
github-actions Bot pushed a commit that referenced this pull request Jul 11, 2024
* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b879.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>
juliaamosova pushed a commit that referenced this pull request Jul 11, 2024
* Revert #46362 (#49404)

* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b879.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>

* Prep for cherry pick 49404

---------

Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: WooCommerce Bot <no-reply@woocommerce.com>
thealexandrelara pushed a commit that referenced this pull request Jul 18, 2024
* Adjust border and box-shadow color for textual inputs

* WIP: Style checkboxes

* Vertically center checkmark

* Adjust focus outline width

* Adjust selected checkbox background in light mode

* Adjust background color of selected radio button

* Add chevron icon to dropdown fields

* Add changelog

* Fix CSS lint issues

* Adjust outline width

* Revert checkbox styles

* Adjust input field height and label size

* Revert box-shadow styles

* Add spacing between coupon title and coupon code

* Simplify onFocus and onBlur

* Fix outline width when focusing combobox

* Ensure chevron points down after selecting value

* Adjust outline color of focused delivery option

* POC: Use currentColor for focus states
thealexandrelara pushed a commit that referenced this pull request Jul 18, 2024
* Revert #46262

* Remove pnpm-lock.yaml

* Revert "Remove pnpm-lock.yaml"

This reverts commit df4b879.

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Revert pnpm-lock.yaml

---------

Co-authored-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. release: highlight Issues that have a high user impact and need to be discussed/paid attention to. Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues status: analysis complete Indicates if a PR has been analysed by Solaris

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Block-based checkout input fields style updates

4 participants