Membership HTML output on contribution pages causing layout errors due to unclosed div - 5.61 regression
Overview
commit:dfc5fb9 caused a regression in the display of the Membership block, where the logic wrapping the "makeContribution" context skips both the closing div and the javascript portion that replaces the auto renew checkbox with a note in force autorenewal mode.
Reproduction steps
- Create a membership contribution page.
- Attempt to use the contribution page.
Current behaviour
The membership block escapes its containment matrix, causing an unclosed div error on the form. This manifests in the browser as a layout nesting issue.
The W3 validator explains the problem as:
Error: End tag form seen, but there were open elements.
From line 1779, column 3; to line 1779, column 9
>↩ ↩ ↩ </form>↩
Error: Unclosed element div.
From line 692, column 3; to line 692, column 128
↩ ↩ <div class="crm-contribution-page-id-7 crm-block crm-contribution-main-form-block" data-page-id="7" data-page-template="main">↩↩
Fatal Error: Cannot recover after last error. Any further errors will be ignored.
From line 1779, column 3; to line 1779, column 9
>↩ ↩ ↩ </form>↩
In addition to this, if the membership type should force autorenewal, it may not due to a missing javascript section.
Expected behaviour
There should be no layout nesting issue, and all divs should be closed appropriately. The script to advise the end use on autorenewal should function.
Environment information
- CiviCRM: Master, 5.61.x
- PHP: 8.0
- CMS: WordPress 6.2.2