What am I doing wrong in my theme that's breaking CAPTCHA? I have a bug in my CAPTCHA implementation. When I click the &quot;Get new captcha!&quot; link, it does not refresh the image CAPTCHA.
After a ton of research in issue queues, testing and breaking my local, and finding everything that was NOT causing it I finally turned off my custom theme and lo, the &quot;Get new captcha!&quot; link works again.
My custom theme is built on USWDS Base theme.

not using a CDN

I'm using:

Drupal 9.0.11
CAPTCHA and Image CAPTCHA 8.x-1.1
USWDS Base Theme 8.x-2-4

No errors are produced in the log or in the console. I &quot;feel&quot; like it might be something related Ajax, but I can't figure out how to sniff it out or narrow it down.
Can anyone give me suggestions for settings I can test and change or specific places in code I might check to try to fix this? Thank you.
Update: I just tried using straight USWDS Base theme, no custom theme, and CAPTCHA bug is still there. So not my custom theme, but my contrib base theme.
I found the conflicting template inside USWDS base theme. For anyone else having this problem, you must alter this template:
/themes/contrib/uswds_base/templates/form/details.html.twig

You can either wholesale replace with the same template from Bartik's classy template (or similar), or else custom rewrite it using the working template from Bartik and customizing it to what you need. I needed to rip out the ul/li based markup that USWDS imposed, but still keep the classes and accessibility markup.
In case it helps anyone else, here's what I ended up using:
&lt;div{{ attributes.addClass('usa-accordion usa-accordion--bordered') }}&gt;
  {%- if title -%}
    {%
      set summary_classes = [
        required ? 'js-form-required',
        required ? 'form-required',
      'usa-accordion__button',
      ]
    %}

    &lt;button type=&quot;button&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;{{ attributes.id }}-content&quot;{{ summary_attributes.addClass(summary_classes) }}&gt;{{ title }}&lt;/button&gt;
  {%- endif -%}
  &lt;div id=&quot;{{ attributes.id }}-content&quot; class=&quot;usa-accordion__content usa-prose&quot;
&gt;
    {% if errors %}
      &lt;div class=&quot;form-item--error-message&quot;&gt;
        &lt;strong&gt;{{ errors }}&lt;/strong&gt;
      &lt;/div&gt;
    {% endif %}
    {%- if description -%}
      &lt;div class=&quot;details-description&quot;&gt;{{ description }}&lt;/div&gt;
    {%- endif -%}
    {%- if children -%}
      {{ children }}
    {%- endif -%}
    {%- if value -%}
      {{ value }}
    {%- endif -%}
  &lt;/div&gt;
&lt;/div&gt;