Normalize form field styling across all themes#340
Conversation
…emes Checkout and login forms had no base CSS for form controls — the plugin relied entirely on the active theme, causing narrow/unstyled inputs in block themes and inconsistent widths between password and text fields. - Populate checkout.css with scoped form normalization under .wu-styling - CSS custom properties (--wu-input-*, --wu-label-*, --wu-submit-*) with theme-aware accent color cascade (Elementor, Kadence, Beaver Builder, block themes, WP admin) - Replace inline styles on site URL prefix/suffix with .wu-input-addon classes - Add wu-styling as dependency for wu-checkout style registration - Enqueue wu-checkout in login form for consistent login/reset styling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe changes introduce a comprehensive checkout form styling system with CSS custom properties for theming and form control normalization. Related PHP files are updated to properly load and apply these styles, with the wu-checkout stylesheet now depending on wu-styling and login form elements enqueuing the checkout stylesheet. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@assets/css/checkout.min.css`:
- Around line 1-13: The :root block is not fully minified (retains
newlines/tabs) while the rest of the stylesheet (e.g., the :root selector and
the .wu-styling rules) is minified; regenerate or re-minify checkout.css so the
:root custom-property block is collapsed to a single line consistent with the
rest of the file—run your CSS minifier over the source checkout.css (fix any
syntax that prevents proper minification in the :root block), or restore the
original source for :root then re-run the build so :root and .wu-styling are
uniformly minified.
🧹 Nitpick comments (4)
assets/css/checkout.css (4)
1-70: Well-structured theming foundation with CSS custom properties.The accent color cascade and custom property system is well-designed for multi-theme compatibility. The documentation comments are thorough and helpful.
One Stylelint fix needed on line 67 — use modern color function notation:
🔧 Proposed fix for Stylelint errors
- --wu-addon-bg: rgba(0, 0, 0, 0.03); + --wu-addon-bg: rgb(0 0 0 / 3%);
86-92:-webkit-appearance: noneflagged by Stylelint but likely intentional for Safari compatibility.Stylelint flags this as
property-no-vendor-prefix, butappearance: nonestill needs the-webkit-prefix for older Safari versions (pre-15.4). If the project's browser support matrix includes those versions, this is fine — consider adding a stylelint-disable comment to suppress the warning.🔧 Suppress lint warning if intentional
appearance: none; + /* stylelint-disable-next-line property-no-vendor-prefix -- needed for Safari < 15.4 */ -webkit-appearance: none;
171-185: Use shorthandborder-radiusto satisfy Stylelint and reduce verbosity.Both
.wu-input-addon-prefixand.wu-input-addon-suffixuse four longhand border-radius properties. Stylelint flags these asdeclaration-block-no-redundant-longhand-properties.♻️ Proposed fix using shorthand
.wu-styling .wu-input-addon-prefix { margin-right: -1px; - border-top-left-radius: var(--wu-input-border-radius); - border-bottom-left-radius: var(--wu-input-border-radius); - border-top-right-radius: 0; - border-bottom-right-radius: 0; + border-radius: var(--wu-input-border-radius) 0 0 var(--wu-input-border-radius); } .wu-styling .wu-input-addon-suffix { margin-left: -1px; - border-top-right-radius: var(--wu-input-border-radius); - border-bottom-right-radius: var(--wu-input-border-radius); - border-top-left-radius: 0; - border-bottom-left-radius: 0; + border-radius: 0 var(--wu-input-border-radius) var(--wu-input-border-radius) 0; }
94-98: Focus style removes outline — verify adequate visual indicator.
outline: noneon Line 97 suppresses the default focus ring for.form-control:focus. The replacementbox-shadowon Line 96 provides a visual indicator, but note thatbox-shadowis not visible in Windows High Contrast Mode (forced-colors). Consider adding a transparent outline for forced-colors accessibility:♿ Proposed a11y improvement
.wu-styling .form-control:focus { border-color: var(--wu-input-focus-border-color); box-shadow: var(--wu-input-focus-shadow); - outline: none; + outline: 2px solid transparent; /* visible in forced-colors / High Contrast Mode */ }
| :root{--wu-accent-fallback-wp:var( | ||
| --wp--preset--color--accent, | ||
| var( | ||
| --wp--preset--color--primary, | ||
| var(--wp-admin-theme-color, #2271b1) | ||
| ) | ||
| );--wu-accent-fallback-bb:var(--fl-global-primary-color, var(--wu-accent-fallback-wp));--wu-accent-fallback-kadence:var(--global-palette1, var(--wu-accent-fallback-bb));--wu-accent-color:var( | ||
| --e-global-color-accent, | ||
| var( | ||
| --e-global-color-primary, | ||
| var(--wu-accent-fallback-kadence) | ||
| ) | ||
| );--wu-input-bg:#fff;--wu-input-color:#1e1e1e;--wu-input-border-color:#949494;--wu-input-border-radius:4px;--wu-input-padding:8px 12px;--wu-input-font-size:16px;--wu-input-line-height:1.5;--wu-input-focus-border-color:var(--wu-accent-color);--wu-input-focus-shadow:0 0 0 1px var(--wu-accent-color);--wu-label-font-size:14px;--wu-label-font-weight:600;--wu-label-color:inherit;--wu-submit-bg:var(--wu-accent-color);--wu-submit-color:#fff;--wu-submit-padding:10px 24px;--wu-submit-border-radius:4px;--wu-submit-font-size:15px;--wu-addon-bg:rgba(0, 0, 0, 0.03);--wu-addon-border-color:var(--wu-input-border-color);--wu-addon-font-size:90%}.wu-styling .form-control{width:100%;box-sizing:border-box;padding:var(--wu-input-padding);font-size:var(--wu-input-font-size);line-height:var(--wu-input-line-height);color:var(--wu-input-color);background-color:var(--wu-input-bg);border:1px solid var(--wu-input-border-color);border-radius:var(--wu-input-border-radius);appearance:none;-webkit-appearance:none;transition:border-color .15s ease,box-shadow .15s ease;max-width:100%}.wu-styling .form-control:focus{border-color:var(--wu-input-focus-border-color);box-shadow:var(--wu-input-focus-shadow);outline:0}.wu-styling .form-control::placeholder{color:#949494;opacity:1}.wu-styling select.form-control{padding-right:36px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;background-size:12px 8px}.wu-styling textarea.form-control{min-height:80px;resize:vertical}.wu-styling label.wu-block{display:block;font-size:var(--wu-label-font-size);font-weight:var(--wu-label-font-weight);color:var(--wu-label-color);margin-bottom:4px}.wu-styling .wu-password-field-container{display:block;width:100%}.wu-styling .wu-input-addon{display:flex;align-items:center;justify-content:center;padding:0 12px;box-sizing:border-box;font-family:monospace;font-size:var(--wu-addon-font-size);background-color:var(--wu-addon-bg);border:1px solid var(--wu-addon-border-color);white-space:nowrap}.wu-styling .wu-input-addon-prefix{margin-right:-1px;border-top-left-radius:var(--wu-input-border-radius);border-bottom-left-radius:var(--wu-input-border-radius);border-top-right-radius:0;border-bottom-right-radius:0}.wu-styling .wu-input-addon-suffix{margin-left:-1px;border-top-right-radius:var(--wu-input-border-radius);border-bottom-right-radius:var(--wu-input-border-radius);border-top-left-radius:0;border-bottom-left-radius:0}.wu-styling .wu-input-grouped{border-radius:0}.wu-styling button.button-primary,.wu-styling input[type=submit].button-primary{display:inline-block;box-sizing:border-box;padding:var(--wu-submit-padding);font-size:var(--wu-submit-font-size);font-weight:600;line-height:1.5;color:var(--wu-submit-color);background-color:var(--wu-submit-bg);border:1px solid transparent;border-radius:var(--wu-submit-border-radius);cursor:pointer;text-align:center;text-decoration:none;appearance:none;-webkit-appearance:none;transition:filter .15s ease}.wu-styling button.button-primary:hover,.wu-styling input[type=submit].button-primary:hover{filter:brightness(.9)}.wu-styling button.button-primary:focus,.wu-styling input[type=submit].button-primary:focus{outline:2px solid var(--wu-accent-color);outline-offset:2px} No newline at end of file |
There was a problem hiding this comment.
Minified file appears partially minified.
The :root block (Lines 1-13) retains tabs and newlines while the rest of the file is properly minified on a single line. This suggests the minification tool may not be handling CSS custom property blocks correctly, or the file was hand-edited. Regenerate this file from the source after applying fixes to checkout.css.
🧰 Tools
🪛 Stylelint (17.2.0)
[error] 13-13: Expected "0.03" to be "3%" (alpha-value-notation)
(alpha-value-notation)
[error] 13-13: Expected "rgba" to be "rgb" (color-function-alias-notation)
(color-function-alias-notation)
[error] 13-13: Expected modern color-function notation (color-function-notation)
(color-function-notation)
[error] 13-13: Expected shorthand property "border-radius" (declaration-block-no-redundant-longhand-properties)
(declaration-block-no-redundant-longhand-properties)
[error] 13-13: Expected shorthand property "border-radius" (declaration-block-no-redundant-longhand-properties)
(declaration-block-no-redundant-longhand-properties)
[error] 13-13: Unexpected vendor-prefixed property "-webkit-appearance" (property-no-vendor-prefix)
(property-no-vendor-prefix)
[error] 13-13: Unexpected vendor-prefixed property "-webkit-appearance" (property-no-vendor-prefix)
(property-no-vendor-prefix)
[error] 13-13: Expected quotes around "submit" (selector-attribute-quotes)
(selector-attribute-quotes)
[error] 13-13: Expected quotes around "submit" (selector-attribute-quotes)
(selector-attribute-quotes)
[error] 13-13: Expected quotes around "submit" (selector-attribute-quotes)
(selector-attribute-quotes)
🤖 Prompt for AI Agents
In `@assets/css/checkout.min.css` around lines 1 - 13, The :root block is not
fully minified (retains newlines/tabs) while the rest of the stylesheet (e.g.,
the :root selector and the .wu-styling rules) is minified; regenerate or
re-minify checkout.css so the :root custom-property block is collapsed to a
single line consistent with the rest of the file—run your CSS minifier over the
source checkout.css (fix any syntax that prevents proper minification in the
:root block), or restore the original source for :root then re-run the build so
:root and .wu-styling are uniformly minified.
Summary
checkout.csswith scoped form normalization CSS (.wu-styling .form-control) for consistent input styling across block themes, classic themes, and page builder setups--wu-input-*,--wu-label-*,--wu-submit-*) with a theme-aware accent color cascade that automatically picks up colors from Elementor, Kadence, Beaver Builder, block themes, and WP admin.wu-input-addonCSS classeswu-checkoutstyle on the login form so login/reset-password pages also get consistent form stylingTest plan
/register/with Twenty Twenty-Five — fields should have consistent width, padding, borderspayment_templatehidden field is not visible (was exposed bydisplay: blockoverride — fixed by removing it)/login/— login form inputs should also be styled--wu-input-border-coloretc. in dev tools to confirm custom properties workvendor/bin/phpunit— all 2871 tests pass🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Style