Repository navigation
Prosopo Procaptcha: keep the widget inside its inline-block wrapper and give it a definite width - #858
Open
forgetso wants to merge 4 commits into
Open
Prosopo Procaptcha: keep the widget inside its inline-block wrapper and give it a definite width#858forgetso wants to merge 4 commits into
forgetso wants to merge 4 commits into
Conversation
The Procaptcha widget sizes itself in percentages under a max-width and has no intrinsic width of its own, so in the shrink-to-fit context inline-block creates it collapses to its minimum size instead of its natural 302px. Set width: 302px with max-width: 100% so it still shrinks inside narrower parents, and keep inline-block for alignment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
forgetso
force-pushed
the
prosopo-procaptcha-inline-block-width
branch
from
October 18, 2026 11:26
54fe623 to
dc4555c
Compare
… in a <p>
The captcha container and validation error were a <div> and a <p>. Form
authors often wrap the procaptcha field in a <p>; the HTML parser closes
that <p> at the first block-level tag, hoisting both out of the inline-block
<mc4wp-procaptcha>, so the widget ignored the form's text-align. Use
display:block spans instead, and drop the closest('form') lookup fallback
that only existed to find the hoisted elements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ameters Lets prosopo.io and the Prosopo portal recognise visitors arriving from the MC4WP integration screen and send them to the right page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #851, which switched
<mc4wp-procaptcha>fromdisplay: blocktodisplay: inline-blockso the widget inherits the surrounding form'stext-align.inline-block is shrink-to-fit, and the Procaptcha widget sizes itself in percentages under a
max-width— it has no intrinsic width of its own for a parent to shrink-wrap around. So the wrapper collapses to the widget's minimum size instead of its natural 302px, which also leaves room for the submit button to flow up alongside it:Reported on themangoroad.com, running 4.14.1. Under
display: blockthe wrapper filled its parent and the widget'smax-widthcapped it, so the missing intrinsic width only became visible after #851.Fix
Add
width: 302px; max-width: 100%to the wrapper's inline style. 302px is the widget's natural width, so the shrink-to-fit calculation has something definite to use, andmax-width: 100%keeps the widget shrinking inside parents narrower than that.display: inline-blockis unchanged, so #851's alignment behaviour is preserved.We're fixing the missing intrinsic width in the Procaptcha widget itself as well, but this keeps the integration correct regardless of which widget version a site loads.
Second fix: keep the widget inside the wrapper when the field is wrapped in a
<p>Site owners often wrap the procaptcha field in a
<p>in the form editor, like their other fields:The wrapper's children were a
<div>(captcha container) and a<p>(validation error). A<p>can't contain either, so the HTML parser closes the outer<p>at the<div>, which also closes<mc4wp-procaptcha>. Both children end up as siblings after an empty wrapper (plus a stray empty<p></p>), so the widget is a block-level box outside the inline-block wrapper and ignores the form'stext-align. #853 stopped this from crashing by looking the elements up from the form, but the widget still rendered outside the wrapper.Reported on missbush.co.uk (4.14.1, centred form, widget stuck to the left).
Both children are now
<span style="display: block">, which a<p>can contain, so the parser leaves them inside the wrapper. The form-level lookup fallback from #853 is removed because nothing is moved out any more.Third change: UTM parameters on the Prosopo links
The two links on the Procaptcha integration settings screen now carry
utm_source=mc4wp&utm_medium=plugin&utm_campaign=integration-settings.https://prosopo.io/wordpress/mc4wp/instead of the prosopo.io home page. That page explains how to set up Procaptcha in MC4WP: get your keys, paste them in, add the field to your form. The home page is aimed at large businesses and doesn't help MC4WP users.https://portal.prosopo.io/site-management.WordPress sends
Referrer-Policy: strict-origin-when-cross-originfrom wp-admin, so all we see today is the site's origin, which looks the same as any other WordPress site. With these parameters we can tell that someone came from the MC4WP integration screen and send them to the right page on our site, with setup steps for this integration rather than our general landing page. Nothing else changes.Test plan
<p>inside a centred form: before, the captcha and error were moved out of<mc4wp-procaptcha>and the widget sat on the left; after, both stay inside and the widget is centred (checked in headless Chromium against the live widget script).php -lclean; phpcs, phpstan and phpunit pass.🤖 Generated with Claude Code