Generated with the help of an LLM. AI assisted with the investigation, patch, regression tests and issue summary.
We have applied the patch in an affected project and verified that it fixes the issue there. A merge request will follow.
Problem/Motivation
With automatic shipping recalculation enabled, changing a required shipping field and clicking “Continue to review” can leave the customer on the same checkout step. Leaving the field triggers recalculation, which disables or replaces the button before the click completes. The customer has to click again.
This is a follow-up to #3633498: Checkout flow saves a stale order and collides with the order lock held by a parallel shipping recalculation. Patch #7 addresses the order-save race, but disabling the button immediately still loses the customer's click. We should retain that action and continue once recalculation finishes.
Steps to reproduce
- Use Commerce Shipping 3.x-dev with patch #7 from #3633498: Checkout flow saves a stale order and collides with the order lock held by a parallel shipping recalculation. Configure a shipping method and enable automatic recalculation and the required shipping profile in the checkout flow.
- Add a shippable product to the cart and enter a valid shipping address.
- Change a required address field, such as the street, then click “Continue to review” directly without first leaving the field.
- Checkout stays on the information step. A second click advances to review.
Expected: one click waits for recalculation and then advances, provided the form passes validation.
Proposed resolution
The follow-up patch applies on top of patch #7 / MR !136. Keep the button enabled and defer its activation while recalculation is pending or running. Once it finishes, activate the current button once, preserving normal form validation.
Handle button replacement or movement during pointer and keyboard activation, while preserving cancellation. Also preserve recalculation after the country widget rebuilds the address fields.
The patch adds three regression tests, all passing with 57 assertions. The single-click and held-Space tests fail with patch #7 alone and pass with this follow-up. The country-change test protects existing recalculation behavior: it passes on the baseline but fails when the detached-input bug found during development is reintroduced.
The latest verification also passes the three order-lock kernel tests (106 assertions) and 32 automated Chrome checks covering pointer, keyboard, validation and AJAX-error behavior.
Remaining tasks
- Postponed on #3633498: Checkout flow saves a stale order and collides with the order lock held by a parallel shipping recalculation / MR !136. Once it is merged, rebase the follow-up onto 3.x and rerun the tests.
- Publish and review the follow-up merge request and test evidence.
- Investigate the remaining full CheckoutPaneTest failures: the last full run had one error and two failures, despite the focused tests passing.
- Test in Firefox, Safari and on physical touch devices.
User interface changes
Customers can activate “Continue to review” once while shipping recalculates. The button remains enabled, with aria-busy set while its activation is deferred.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce_shipping-preserve-continue-click-3634785-3.patch | 15.14 KB | dpacassi |
Issue fork commerce_shipping-3634785
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dpacassiAttached a static patch containing only this issue’s changes and regression tests, matching commit
7cc7d37in MR !138.Apply the prerequisite patch from #3633498: Checkout flow saves a stale order and collides with the order lock held by a parallel shipping recalculation comment #7 first. The attached patch does not include those changes.
The three focused FunctionalJavascript tests pass (57 assertions). The fix was also verified in the affected project. The MR remains a draft; outstanding verification is documented there. Leaving this issue postponed pending the prerequisite.
AI assisted with the implementation, tests and this comment.
Comment #4
dpacassiInvestigated the five
ProfileFieldCopyTestfailures in pipeline #1027498. The failed-page artifacts show access denied on the initial checkout request, before shipping JavaScript loads. CI installs Commerce 3.3.13, which requires draft checkout orders to havecart = TRUE; the existing test fixture omits that flag.Using that access check locally reproduces all five failures with the prerequisite alone and with this follow-up. Temporarily marking the fixture as a cart and waiting for valid submissions to reach review makes all five tests pass in both states (195 assertions each). The diagnostic changes were restored; the patch is unchanged. This explains these CI failures, but does not resolve the other verification tasks.
Updated MR !138 with the comparison details and limitations. Keeping it draft and this issue postponed on #3633498: Checkout flow saves a stale order and collides with the order lock held by a parallel shipping recalculation. AI assisted with the investigation and this comment.