Captcha Keypad works on Drupal 12 when it places itself on forms via its own
settings page. Using it *through* the CAPTCHA module does not, and the fix is
not in this project.
## What users see
On Drupal 12, with a CAPTCHA point set to `captcha_keypad/Keypad`, no challenge
is rendered on the protected form at all.
Standalone use — Captcha Keypad's own "Forms" settings — is unaffected and
works on Drupal 12.
## It is not this module
CAPTCHA declares `core_version_requirement: ^9.5 || ^10 || ^11`, so it will not
install on Drupal 12 in the first place. Widening that constraint locally to
allow ^12, CAPTCHA installs but still renders nothing — and not just for our
challenge: CAPTCHA's own `captcha/Math` challenge also renders nothing on the
login form.
The element is added to the form array, so `captcha_form_alter()` is running:
$form = \Drupal::formBuilder()->getForm(\Drupal\user\Form\UserLoginForm::class);
// keys: name, pass, actions, form_build_id, form_id, captcha
It renders to nothing, which points at the CAPTCHA render element or its
pre-render rather than at the form alter.
Captcha Keypad's own side is fine. Its `hook_captcha()` implementation is
registered and returns the challenge on Drupal 12:
\Drupal::moduleHandler()->invoke('captcha_keypad', 'captcha', ['list']);
// ["Keypad"]
and `CaptchaIntegrationTest` passes on Drupal 10.6 and 11.4.
Verified on Drupal 12.0-dev, PHP 8.5.8, CAPTCHA 2.0.10.
## Blocked on
[#3596096: Automated Drupal 12 compatibility fixes for captcha 2.x-dev](https://www.drupal.org/project/captcha/issues/3596096)
That issue has been at "Needs review" since June with an automated Rector merge
request. The Rector changes are necessary but not sufficient — the render
failure above survives them, which is why CAPTCHA has not declared Drupal 12
support yet.
## What we did in the meantime
#3618825: phpunit (next major) is red for reasons unrelated to this module(https://www.drupal.org/project/captcha_keypad/issues/3618825)
made `CaptchaIntegrationTest` skip when CAPTCHA cannot be installed, so the
next-major CI job reports this accurately instead of failing. The skip is keyed
on the install failure rather than a core version check, so the test starts
running again by itself as soon as CAPTCHA supports the core version under
test — no change needed here.
The 2.0.0 release notes tell anyone using Captcha Keypad through the CAPTCHA
module to stay on Drupal 11 until this is resolved.
## Remaining task here
When CAPTCHA ships Drupal 12 support: confirm `CaptchaIntegrationTest` runs
(rather than skips) and passes on the next-major job, drop the caveat from the
release notes, and close this.
Comments
Comment #2
marcelovani