Skip to content

fix(captcha): the widget's corners and typography, and a guard for both (#1053) - #1070

Merged
rpgmem merged 1 commit into
developfrom
claude/altcha-widget-typography-4vvuer
Sep 5, 2026
Merged

fix(captcha): the widget's corners and typography, and a guard for both (#1053)#1070
rpgmem merged 1 commit into
developfrom
claude/altcha-widget-typography-4vvuer

Conversation

@rpgmem

@rpgmem rpgmem commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

Dois achados do smoke no ambiente de testes, ambos meus, e ambos invisíveis fora da página renderizada.

  • Quinas retas. O arredondamento era pedido com var(--ffc-radius) — um token declarado em ffc-recruitment-public.css e ffc-user-dashboard.css, que não carregam nas páginas onde o widget aparece. Uma custom property indefinida invalida a declaração inteira em silêncio, então o var(--altcha-border-radius, 0) do próprio widget caía no fallback 0. Passa a nomear --ffc-radius-sm, o raio do .ffc-input ao lado do qual a caixa fica.
  • Fonte herdada. Tudo dentro do widget é font-family: inherit / font-size: inherit, enquanto os campos do formulário têm tamanho próprio — num tema de corpo 20px o captcha saía na tipografia do tema, um tamanho acima da pergunta ao lado. Agora é o tamanho do label da linha matemática (18px) e a família do plugin.
  • CssTokenReferenceTest falha quando um var(--ffc-*) sem fallback não resolve nem no próprio arquivo nem em ffc-common.css.

Medido, não deduzido

Rodei o widget no Chromium com uma página que imita a estrutura e os tokens do formulário. Antes e depois, computados:

raio fonte família
label do formulário 18px -apple-system
widget, antes 0px 20px Georgia (do tema)
widget, depois 6px* 18px -apple-system

* a sonda usou --ffc-radius-md; o commit usa --ffc-radius-sm (4px), que é o do .ffc-input.

A mesma medição corrigiu uma afirmação do comentário daquele bloco: o widget renderiza em light DOM, não em shadow root (element.shadowRoot === null). Os internos continuam sendo endereçados pelas custom properties e não por classe — são a superfície que o bundle publica; um nome de classe pode mudar entre versões.

Por que um guarda, e não só a correção

É a segunda vez neste épico que eu nomeio uma variável CSS que não existe (a primeira foram nomes --altcha-* inventados). O modo de falha é o pior possível: zero erro no console, a regra simplesmente não se aplica. Rodado sobre assets/css/ inteiro o guarda encontra exatamente este bug e mais três referências deliberadas a --ffc-color, escrito inline por elemento como swatch de cor — allowlistadas com o motivo ao lado.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would alter existing behavior)
  • Refactor / chore (no functional change)
  • Documentation only

Test plan

  • vendor/bin/phpunit — 7593 testes, 21792 asserções, verde
  • composer lint (PHPStan) — não rodado localmente: o vendor/ deste container não tem o PHPStan e o composer install não autentica no github.com. Nenhum arquivo PHP de produção mudou nesta PR, então o escopo analisado não muda; a CI é o gate
  • Stylelint e phpcs-tests.xml.dist limpos
  • CssTokenReferenceTest verificado falhando contra o token original (ffc-frontend.css:513 references --ffc-radius…) e voltando a passar com a correção
  • Medição no Chromium, antes e depois (tabela acima)
  • Smoke manual — pendente, depois do deploy

Checklist

  • CSS re-minificado (npm run build:css), .min.css commitado
  • CHANGELOG.md atualizado ([Unreleased] / Fixed)
  • readme.txt — não se aplica: a versão só é consolidada na PR de release
  • Sem novas entradas na baseline do PHPStan
  • Sem segredos, tokens ou PII no diff

Parte do épico #1053.

🤖 Generated with Claude Code

https://claude.ai/code/session_012XWx9qJdjZdAq8crxM9GCU


Generated by Claude Code

…th (#1053)

Two findings from the testes environment, both mine, and both invisible
anywhere but the rendered page.

The rounded corners were asked for with var(--ffc-radius) — a token declared
only in the recruitment and user-dashboard sheets, neither of which loads on
the pages the widget renders on. An undefined custom property makes the whole
declaration invalid at computed-value time, in silence, so the widget's own
var(--altcha-border-radius, 0) fell through to its fallback and the box had
square corners. It now names --ffc-radius-sm, the radius of the input the box
sits beside.

Typography was inherited. Everything inside the widget is font-family and
font-size inherit, while the form's own fields carry their own sizes, so on a
theme with a 20px body the captcha rendered in the theme's face one size
larger than the question next to it. Measured in Chromium rather than
reasoned about: 20px Georgia against the form's 18px. It is now set to the
math row's label size and the plugin's family.

The same measurement corrected a claim in that stylesheet's own comment: the
widget renders into the light DOM, not a shadow root.

CssTokenReferenceTest fails when a var(--ffc-*) without a fallback resolves in
neither its own file nor ffc-common.css. Run over the whole directory it finds
exactly this bug and three deliberate runtime tokens, which are allowlisted
with the reason inline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012XWx9qJdjZdAq8crxM9GCU
@rpgmem
rpgmem marked this pull request as ready for review September 5, 2026 23:45
@rpgmem
rpgmem enabled auto-merge (squash) September 5, 2026 23:45
@rpgmem
rpgmem merged commit 55c58fe into develop Sep 5, 2026
19 checks passed
@rpgmem
rpgmem deleted the claude/altcha-widget-typography-4vvuer branch September 5, 2026 23:54
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 33999277230

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit fe6cbad on develop.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 89.897%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 53867
Covered Lines: 48425
Line Coverage: 89.9%
Coverage Strength: 4.84 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants