Skip to content

Use inline-block on procaptcha wrapper so it inherits form alignment - #851

Merged
dannyvankooten merged 1 commit into
ibericode:mainfrom
prosopo:prosopo-procaptcha-alignment-setting
Aug 12, 2026
Merged

dannyvankooten merged 1 commit into
ibericode:mainfrom
prosopo:prosopo-procaptcha-alignment-setting

Conversation

@forgetso

@forgetso forgetso commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Originally I added a Left/Center/Right toggle so users could work around themes (e.g. Woodmart) that center the surrounding form but leave the captcha widget hard-left:

image

Simpler fix: change the <mc4wp-procaptcha> wrapper from display: block to display: inline-block. Block-level elements ignore text-align on their parent; inline-block elements honor it. So the widget now inherits whatever alignment the surrounding form uses, and no user-facing setting is needed.

Verified locally against left/center/right parents with the real Prosopo widget.

The wrapper was display:block, which meant themes that centered the
surrounding form (e.g. Woodmart with text-align:center) still rendered
the widget hard-left. Switching to display:inline-block lets the parent
form's text-align propagate to the widget without any user-facing
setting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@forgetso
forgetso force-pushed the prosopo-procaptcha-alignment-setting branch from cf1267b to bba9812 Compare August 10, 2026 12:53
@forgetso forgetso changed the title Add alignment setting to Prosopo Procaptcha integration Use inline-block on procaptcha wrapper so it inherits form alignment Aug 10, 2026
@dannyvankooten
dannyvankooten merged commit bb1bf55 into ibericode:main Aug 12, 2026
8 checks passed
forgetso added a commit to prosopo/captcha that referenced this pull request Oct 18, 2026
A host that sizes the widget by measuring it — an inline-block, a float,
an auto-sized grid or flex item, an absolutely positioned box — asks how
wide the widget wants to be. __wrapper is `container-type: size`, so it
is measured as if it were empty and answers with nothing, and every
other box sizes in percentages, which resolve as `auto` against an
indefinite width. The host found only __wrapper's 170px min-width and
laid the widget out at that floor, in its smallest container-query
breakpoint: 10px label, logo crammed against the checkbox.

Add a zero-height row of two unwrappable boxes as a sibling of the
contained wrapper, so min-content is the wider box (the floor) and
max-content is the pair (302px, the natural width). Measured in Chrome
across block, inline-block, float, flex item, flex column with
align-items, auto grid track, table cell, absolute and fit-content
parents at 150/170/250/500px: the widget now lays out at 302px wherever
there is room and shrinks to the parent where there is not.

A definite `width: 302px` on __outer also fixes the wide cases, but sets
min-content as well as max-content, so the widget overflows any
shrink-to-fit host narrower than 302px instead of shrinking into it.
`contain-intrinsic-width` has the same problem — it cannot express a
min-content that differs from max-content.

Found via Mailchimp for WordPress, whose wrapper became an inline-block
in ibericode/mailchimp-for-wordpress#851.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants