[2.x] Improve the CAPTCHA form markup and use twig files for more flexibility, where possible

Created on 11 October 2022, about 2 years ago
Updated 7 June 2023, over 1 year ago

Problem/Motivation

Main parts of the CAPTCHA 8.x-1.x module seem to be a port of the Drupal 7 CAPTCHA module, with quite similar implementation.

But since Drupal 8 form styling and overriding was improved a lot by using twig files for form elements where ever possible. Trying to reduce the need for hooks to theme Drupal forms (as it's bad for theme developers / designers).

Having a look at the resulting markup and the implementation, CAPTCHA didn't improve a lot here. The resulting markup, which is also used by CAPTCHA extending modules like

and other CAPTCHA types using hook_captcha() can also be improved.

In this task we should discuss two things:
1. How to better use twig files to replace the need for hooks and technical FAPI implementations for theming the CAPTCHA generate output
2. How to improve the currenct CAPTCHA output markup like for example:

  • Add a class for the captcha type to the wrapper element
  • Discuss if "details" is really a good choice for a required form element wrapper - I guess not ;)
  • Make the "details" title configurable in the CAPTCHA settings with default: "CAPTCHA"
  • Allow to change the order / alignment of the captcha elements, for example beside or below each other by CSS
  • Don't use "CAPTCHA" as readable label in the frontend, most of the users have no idea what this means. So this is a useless label.
  • #3258191: Surround the 'Challenge description' phrase with an html tag
  • ...?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024