Skip to content

fix(checkout-editor): make mobile editor and Add Field modal usable on phones#1162

Merged
superdav42 merged 1 commit intomainfrom
fix/checkout-editor-mobile-inline-css
May 8, 2026
Merged

fix(checkout-editor): make mobile editor and Add Field modal usable on phones#1162
superdav42 merged 1 commit intomainfrom
fix/checkout-editor-mobile-inline-css

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 8, 2026

Summary

Fixes three usability defects that made the checkout form editor and its "Add new Field" modal effectively unusable on phones (viewport <= 782px).

Defect Root cause Fix
Expanded-row TYPE / SLUG / MOVE labels collapse to 1 char per line (T..s it e_ ur l instead of Type: site_url) and overlap the value WP core list-tables CSS positions the ::before data-colname label absolutely in a 32 %-wide strip on the left; inside the narrow checkout-editor postbox that strip is too thin Stack the expanded row vertically: label on its own row above the value (position: static; display: block; white-space: normal)
"Add new Field" modal overflows the viewport, clipping tile labels on both edges wubox.js sets the modal width inline (600px for this dialogue, 630px default) and the existing responsive rule only kicks in below 400px Bump the wubox breakpoint from 400px to 782px (WP admin mobile breakpoint) and override the inline pixel width with width: 100vw !important
Field-type tile grid produces ~24 vw tiles on phones; labels like PASSWORD, TEMPLATES, DOMAIN SELECTION get clipped wu-w-1/4 (25 %) is fine on desktop but too narrow on phones Drop to a 2-column grid on mobile (.wu-w-1\/4 { width: 50% !important }), scoped to the add_checkout_form_field Vue app so it does not affect other 4-column grids

Why this also touches wp_add_inline_style

PR #1135 established that feature branches must not hand-edit .min.css because those files are regenerated only at release time. Production users load checkout-editor.min.css and admin.min.css, so a source-only fix would not reach them until the next release.

This PR follows the pattern PR #1135 introduced for the toolbar fix:

  • The authoritative rules live in assets/css/checkout-editor.css and assets/css/admin.css (so the next release rebuild captures them naturally).
  • The same @media (max-width: 782px) block is also injected via wp_add_inline_style('wu-checkout-form-editor', ...) from Checkout_Form_Edit_Admin_Page::register_scripts(), so production users on the current .min.css get the fix immediately.
  • Both copies cross-reference each other in comments to keep them in sync.
  • checkout-editor.min.css and admin.min.css are not modified on this branch (the existing Checkout_Editor_Assets_Test::test_checkout_editor_min_css_should_not_be_modified_on_feature_branches guard from PR GH#1134: guard checkout editor generated CSS state #1135 still passes).

Tests

tests/unit/Checkout_Editor_Assets_Test.php extended with a new test:

  • test_checkout_editor_mobile_styles_are_injected_inline_for_min_css_users — asserts wp_add_inline_style is wired up on wu-checkout-form-editor and contains the expected selectors (hidden ORDER column, fixed expanded SLUG cell, #WUB_window viewport cap, scoped add_checkout_form_field selector, 2-column grid override).
$ vendor/bin/phpunit --filter Checkout_Editor_Assets_Test --no-coverage
OK (2 tests, 16 assertions)

PHPCS, PHPStan, and Stylelint (on touched files) all clean.

Verification

Verified manually in the dev WordPress install at wordpress.local:8080 using agent-browser with logged-in admin cookies:

Viewport Scenario Result
390 x 844 Checkout editor (collapsed) ORDER / MOVE columns hidden, postbox header stacked
390 x 844 Checkout editor (row expanded) Labels render inline above values, no character-per-line wrap
390 x 844 "Add new Field" modal Fills viewport, 2-column grid, all labels readable
390 x 844 Per-field edit modal Fills viewport, form fields usable
1280 x 800 Checkout editor Unchanged: 5 columns, no layout shift
1280 x 800 "Add new Field" modal Unchanged: centred at 600 px, 4-column grid

Files changed

  • assets/css/checkout-editor.css — adds responsive @media rules for expanded rows, MOVE column, modal, grid
  • assets/css/admin.css — bumps wubox responsive breakpoint 400px -> 782px, adds width: 100vw !important
  • inc/admin-pages/class-checkout-form-edit-admin-page.phpwp_add_inline_style call in register_scripts() mirroring the source CSS
  • tests/unit/Checkout_Editor_Assets_Test.php — new test asserting the inline registration

Closes the mobile-usability follow-ups from PR #1073 and PR #1135.


Summary by CodeRabbit

  • Bug Fixes

    • Fixed modal window overflow and positioning issues on small screens.
    • Improved layout and label visibility on mobile devices for the checkout form editor.
    • Adjusted form field grid layout for better display on narrow viewports.
  • Tests

    • Added test coverage for mobile styling in the checkout editor.

…n phones

The mobile (<=782px) view of the checkout form editor had three usability
defects that made the screen effectively unusable on phones:

1. The expanded-row layout for TYPE / SLUG / MOVE columns relied on
   WordPress core's responsive list-table CSS, which absolutely positions
   the data-colname label in a 32%-wide strip on the left of each cell.
   Inside the narrow checkout-editor postbox that strip is too thin and
   the label collapses to one character per line ('T..s it e_ ur l'
   instead of 'Type: site_url'), with the value text overlapping it.
2. The 'Add new Field' wubox modal used a 600px fixed pixel width set
   inline by wubox.js, overflowing the viewport on phones and clipping
   labels on both edges.
3. The field-type tile grid used wu-w-1/4 (4 columns), producing ~24vw
   tiles on phones — too narrow for labels like 'PASSWORD',
   'TEMPLATES', and 'DOMAIN SELECTION'.

Fixes:

- Add a new @media (max-width: 782px) block to checkout-editor.css that
  switches the expanded-row layout to a stacked block layout (label on
  its own row above the value), hides the ORDER and MOVE columns, and
  stacks the postbox header and step action buttons vertically.
- Bump the existing wubox responsive breakpoint in admin.css from 400px
  to 782px (the WordPress admin mobile breakpoint) and override the
  inline pixel width with width: 100vw !important so the modal fills
  the screen on phones.
- Drop the field-type tile grid from 4 columns to 2 on mobile so each
  label has room to render.

Production users load checkout-editor.min.css and admin.min.css, which
are rebuilt only at release time. Per PR #1135, feature branches must
not hand-edit the .min.css files. To ship the fix to production users
immediately, the same @media block is also injected via
wp_add_inline_style() from Checkout_Form_Edit_Admin_Page::register_scripts().
The source .css and inline-PHP copies cross-reference each other so
they stay in sync.

Tests:

- Extends tests/unit/Checkout_Editor_Assets_Test.php (introduced in
  PR #1135) with a new test asserting the wp_add_inline_style call is
  wired up and contains the expected selectors and rules. The existing
  source-only guard remains intact: checkout-editor.min.css is not
  modified on this branch.

Verified at 390x844 (collapsed, expanded, modal, per-field edit) and
1280x800 (5 columns, modal centered at 600px) — desktop unaffected.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Mobile responsive CSS rules for admin modals and checkout editor UI are expanded and refactored to use inline PHP injection via wp_add_inline_style(). This keeps mobile-specific styling maintainable in source files without requiring manual edits to minified production assets, with test verification confirming the injection occurs and rules are not duplicated.

Changes

Mobile Responsive CSS & Inline Injection

Layer / File(s) Summary
Admin WUBox Modal Mobile Rules
assets/css/admin.css
WUBox modal responsive rule updated from max-width: 400px to max-width: 782px with full viewport width (100vw), cleared margins/positioning, and removed border radius for edge-to-edge mobile layout.
Checkout Editor Mobile CSS
assets/css/checkout-editor.css
Mobile stylesheet gains responsive table-row stacking (type, slug, move columns rendered as blocks), hides the move column, constrains "Add new Field" modal to 100vw with reset offsets, and reduces field-type grid from 4 columns to 2.
Inline Style Injection
inc/admin-pages/class-checkout-form-edit-admin-page.php
Checkout form editor admin page registers inline styles via wp_add_inline_style('wu-checkout-form-editor', ...), injecting mobile media-query rules to keep source-of-truth separate from minified CSS.
Test Verification
tests/unit/Checkout_Editor_Assets_Test.php
New test verifies inline style injection for wu-checkout-form-editor handle and confirms mobile media query rules are injected; existing test verifies rules do not appear in minified CSS.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Ultimate-Multisite/ultimate-multisite#1073: Both PRs modify the checkout editor's mobile @media rules (max-width:782px) including hiding MOVE/ORDER columns, stacking header elements, and fixing mobile layout.

Suggested labels

origin:interactive

Poem

A rabbit hops through viewport widths with glee, 🐰
Mobile styles now dance at 782 degrees,
No more margins and offsets to fight,
Inline injection keeps everything right,
From admin to checkout, responsive delight! 📱✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main purpose of the PR: fixing mobile usability issues in the checkout editor and Add Field modal on phones.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/checkout-editor-mobile-inline-css

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🔨 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!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
assets/css/checkout-editor.css (1)

85-114: 💤 Low value

td.column-move in the stacked-layout selector group is dead code.

td.column-move is included in the stacked-layout group at line 87 (setting display: block !important) and in the ::before group at line 96, but both are immediately negated by display: none !important at line 113. The ::before rule for column-move can never be rendered since the cell itself is hidden. Removing td.column-move (and td.column-move::before) from the first two selector groups would reduce confusion.

♻️ Proposed simplification
  `#wu-checkout-editor-app` tr.is-expanded td.column-type,
- `#wu-checkout-editor-app` tr.is-expanded td.column-slug,
- `#wu-checkout-editor-app` tr.is-expanded td.column-move {
+ `#wu-checkout-editor-app` tr.is-expanded td.column-slug {
    position: relative !important;
    display: block !important;
    width: auto !important;
    padding: 6px 12px !important;
    text-align: left !important;
  }
  `#wu-checkout-editor-app` tr.is-expanded td.column-type::before,
- `#wu-checkout-editor-app` tr.is-expanded td.column-slug::before,
- `#wu-checkout-editor-app` tr.is-expanded td.column-move::before {
+ `#wu-checkout-editor-app` tr.is-expanded td.column-slug::before {
    position: static !important;
    display: block !important;
    float: none !important;
    width: auto !important;
    padding: 0 0 4px 0 !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
    font-weight: 600;
    text-align: left !important;
  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@assets/css/checkout-editor.css` around lines 85 - 114, Remove the dead
selectors for the MOVE column: delete td.column-move and td.column-move::before
from the stacked-layout selector groups that start with "#wu-checkout-editor-app
tr.is-expanded td.column-type, `#wu-checkout-editor-app` tr.is-expanded
td.column-slug, `#wu-checkout-editor-app` tr.is-expanded td.column-move" and the
corresponding "::before" group so those rules only target column-type and
column-slug; leave the explicit rule "#wu-checkout-editor-app tr.is-expanded
td.column-move { display: none !important; }" intact so the MOVE column remains
hidden.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/Checkout_Editor_Assets_Test.php`:
- Around line 41-45: The current test in Checkout_Editor_Assets_Test.php uses a
whitespace-sensitive assertStringContainsString with an exact "\n\t\t\t"
indentation; update this to avoid coupling to formatting by replacing the single
whitespace-dependent assertion with two independent assertions that check for
the presence of "wp_add_inline_style(" and the handle
"'wu-checkout-form-editor'" separately (both against $admin_page_contents), or
alternatively normalize whitespace (e.g., preg_replace('/\s+/', ' ',
$admin_page_contents)) before asserting; ensure the check still verifies that
register_scripts() triggers wp_add_inline_style with the wu-checkout-form-editor
handle.

---

Nitpick comments:
In `@assets/css/checkout-editor.css`:
- Around line 85-114: Remove the dead selectors for the MOVE column: delete
td.column-move and td.column-move::before from the stacked-layout selector
groups that start with "#wu-checkout-editor-app tr.is-expanded td.column-type,
`#wu-checkout-editor-app` tr.is-expanded td.column-slug, `#wu-checkout-editor-app`
tr.is-expanded td.column-move" and the corresponding "::before" group so those
rules only target column-type and column-slug; leave the explicit rule
"#wu-checkout-editor-app tr.is-expanded td.column-move { display: none
!important; }" intact so the MOVE column remains hidden.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4011ef15-d0e6-43a0-91d2-3b3e506b99a4

📥 Commits

Reviewing files that changed from the base of the PR and between 55560d7 and 0bc2d7f.

📒 Files selected for processing (4)
  • assets/css/admin.css
  • assets/css/checkout-editor.css
  • inc/admin-pages/class-checkout-form-edit-admin-page.php
  • tests/unit/Checkout_Editor_Assets_Test.php

Comment on lines +41 to +45
$this->assertStringContainsString(
"wp_add_inline_style(\n\t\t\t'wu-checkout-form-editor'",
$admin_page_contents,
'Expected register_scripts() to call wp_add_inline_style on wu-checkout-form-editor so mobile rules ship without rebuilding the .min.css'
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Whitespace-sensitive assertion will break on code reformatting.

The assertion embeds \n\t\t\t (newline + 3 tabs), coupling the test to the exact indentation of the PHP source. Any code formatter (PHPCBF, php-cs-fixer) that adjusts indentation or newline style will cause this test to fail even with functionally identical code.

🛡️ Proposed fix — split into two independent assertions
-		$this->assertStringContainsString(
-			"wp_add_inline_style(\n\t\t\t'wu-checkout-form-editor'",
-			$admin_page_contents,
-			'Expected register_scripts() to call wp_add_inline_style on wu-checkout-form-editor so mobile rules ship without rebuilding the .min.css'
-		);
+		$this->assertStringContainsString(
+			'wp_add_inline_style(',
+			$admin_page_contents,
+			'Expected register_scripts() to call wp_add_inline_style()'
+		);
+		$this->assertStringContainsString(
+			"'wu-checkout-form-editor'",
+			$admin_page_contents,
+			'Expected wp_add_inline_style to target the wu-checkout-form-editor handle'
+		);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/Checkout_Editor_Assets_Test.php` around lines 41 - 45, The current
test in Checkout_Editor_Assets_Test.php uses a whitespace-sensitive
assertStringContainsString with an exact "\n\t\t\t" indentation; update this to
avoid coupling to formatting by replacing the single whitespace-dependent
assertion with two independent assertions that check for the presence of
"wp_add_inline_style(" and the handle "'wu-checkout-form-editor'" separately
(both against $admin_page_contents), or alternatively normalize whitespace
(e.g., preg_replace('/\s+/', ' ', $admin_page_contents)) before asserting;
ensure the check still verifies that register_scripts() triggers
wp_add_inline_style with the wu-checkout-form-editor handle.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Performance Test Results

Performance test results for a7534d3 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.78 MB 804.50 ms 156.50 ms (+4.50 ms / +3% ) 976.50 ms 1964.00 ms 1866.75 ms 93.50 ms
1 56 49.12 MB 969.00 ms (+62.50 ms / +6% ) 146.00 ms (+4.00 ms / +3% ) 1112.50 ms (+61.00 ms / +5% ) 2146.00 ms (+116.00 ms / +5% ) 2063.75 ms (+118.05 ms / +6% ) 81.25 ms

@superdav42 superdav42 merged commit 200a690 into main May 8, 2026
11 checks passed
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.

1 participant