You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"An invalid form control is not focusable" on multi-step forms with mandatory conditional checkbox groups #128
When a powermail multi-step form contains a mandatory checkbox group (multiple checkboxes sharing name="…[]") that is conditionally hidden/shown by EXT:powermail_cond, submitting the form after checking a non-first checkbox of that group produces a browser console error:
An invalid form control with name='tx_powermail_pi1[field][<marker>][]' is not focusable.
and blocks form submission.
Root cause:
Two bugs in PowermailConditions.js:
#getFieldByMarker returns only the first checkbox. It uses querySelector (singular), so #hideField/#showField only disable/enable and derequire/rerequire the first checkbox of a multi-value group. The remaining checkboxes keep their validation state unchanged.
#rerequireField converts data-powermail-required to native required. Powermail renders multi-checkbox mandatory fields with data-powermail-required="true" (not native required) and handles "at least one checked" via data-powermail-multiple. The old #rerequireField unconditionally restored a native required attribute, which the browser's reportValidity() (called by #submitListener) then tried to enforce. In a multi-step form the field's fieldset is display:none (hidden by the morestep navigation), so the browser cannot focus the invalid checkbox and emits the "not focusable" error.
Trigger conditions (all required):
Multi-step form (moresteps=1) with 2+ pages
Mandatory checkbox group on a non-final step, conditionally hidden by powermail_cond
Powermail JS validation active (data-powermail-validate)
User checks a non-first checkbox of the shown group, then navigates to the next step and submits
Fix:
#hideField/#showField: iterate querySelectorAll('input, select, textarea') over the wrapping container so all inputs in a multi-value group are disabled/enabled and derequired/rerequired.
#derequireField/#rerequireField: bookmark which attribute was present (required or data-powermail-required) and restore the same one, preserving powermail's custom validation mechanism for multi-checkbox groups.
Activity
[BUGFIX] Fix "not focusable" error on mandatory conditional checkbox …