Skip to content

fix(website): remove invalid Turnstile size 'invisible', hide container via CSS#1590

Merged
yamadashy merged 2 commits into
yamadashy:mainfrom
serhiizghama:fix/turnstile-invalid-size-param
May 24, 2026
Merged

fix(website): remove invalid Turnstile size 'invisible', hide container via CSS#1590
yamadashy merged 2 commits into
yamadashy:mainfrom
serhiizghama:fix/turnstile-invalid-size-param

Conversation

@serhiizghama

Copy link
Copy Markdown
Contributor

Problem

Cloudflare Turnstile throws a TurnstileError when size: 'invisible' is passed to render():

Uncaught TurnstileError: [Cloudflare Turnstile] Invalid value for parameter "size",
expected "compact", "flexible", or "normal", got "invisible".

This breaks the Pack form on repomix.com for affected users (reported in #1551).

The valid values for the size parameter are 'normal', 'compact', and 'flexible'. The value 'invisible' was never a documented Turnstile option and is rejected by recent Turnstile script versions.

Solution

  1. useTurnstile.ts — remove size: 'invisible' from the render() options. The non-interactive behaviour is already provided by execution: 'execute', which defers the challenge until mintToken() is called.

  2. useTurnstileScript.ts — update the TurnstileRenderOptions.size type to match the actual API ('normal' | 'compact' | 'flexible').

  3. TryIt.vue — add a .turnstile-container CSS rule (position: absolute; width/height: 0; overflow: hidden; visibility: hidden) so the widget does not consume layout space or appear visually when rendered without a size.

Testing

  • npm run lint — no errors
  • npm run test — all 1312 tests pass
  • Verified the render options no longer include size: 'invisible'

Fixes #1551

…ptions

Cloudflare Turnstile does not accept 'invisible' as a size value; the valid
options are 'normal', 'compact', and 'flexible'. Passing 'invisible' throws a
TurnstileException in recent Turnstile script versions, breaking the pack form.

The invisible behaviour is already achieved via execution: 'execute', which
defers the challenge until mintToken() is called. The size parameter is only
needed when rendering a visible widget.
…ible

Without a size value, Turnstile renders a visible widget inside the container
div. Collapse it with position: absolute; width/height: 0; overflow: hidden;
visibility: hidden so no layout space is consumed and the widget stays inert.
@serhiizghama serhiizghama requested a review from yamadashy as a code owner May 22, 2026 01:50
@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 25af9a85-87c4-4f76-ad0b-dabfd8425a24

📥 Commits

Reviewing files that changed from the base of the PR and between 5f70439 and 9c1d961.

📒 Files selected for processing (3)
  • website/client/components/Home/TryIt.vue
  • website/client/composables/useTurnstile.ts
  • website/client/composables/useTurnstileScript.ts
💤 Files with no reviewable changes (1)
  • website/client/composables/useTurnstile.ts

📝 Walkthrough

Walkthrough

The PR fixes a Cloudflare Turnstile initialization error by replacing the unsupported size: 'invisible' option with CSS-based hiding. The TypeScript type contract is updated to reflect valid sizes (normal, compact, flexible), the render call removes the invalid option, and component styles hide the container visually while preserving DOM presence.

Changes

Turnstile widget size compatibility fix

Layer / File(s) Summary
Type definition and initialization update
website/client/composables/useTurnstileScript.ts, website/client/composables/useTurnstile.ts
TurnstileRenderOptions.size type replaces 'invisible' with 'flexible' to match Cloudflare's supported values, and the explicit size override is removed from turnstile.render() configuration.
Container styling to hide widget visually
website/client/components/Home/TryIt.vue
Scoped CSS for .turnstile-container sets zero dimensions, hides visibility, and disables pointer events to keep the widget in the DOM without affecting layout or interaction.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • yamadashy/repomix#1538: Introduced the Turnstile client widget integration in TryIt.vue and useTurnstile composable that this PR patches for compatibility.
  • yamadashy/repomix#1541: Modifies the same useTurnstile.ts render configuration and defers the render call until token retrieval, creating potential interaction with this PR's removal of the size override.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing the invalid Turnstile 'invisible' size option and hiding the container via CSS instead.
Description check ✅ Passed The description includes problem statement, solution with file-by-file breakdown, and testing confirmation, but lacks a summary section at the top.
Linked Issues check ✅ Passed The PR fully addresses issue #1551 by removing the invalid 'invisible' size parameter, updating type definitions, and hiding the widget container via CSS instead.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the Turnstile 'invisible' size error and related type definitions; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Cloudflare Turnstile integration by removing the 'invisible' size option and updating the type definitions to include 'flexible' sizing. It also introduces a .turnstile-container CSS class to hide the widget while keeping it in the DOM for programmatic execution. Feedback suggests that using zero dimensions and hidden visibility might trigger Turnstile's anti-tamper checks, recommending an off-screen positioning strategy instead to ensure the widget initializes correctly.

Comment thread website/client/components/Home/TryIt.vue
@yamadashy

Copy link
Copy Markdown
Owner

Hi @serhiizghama !
Thanks for the fix!
We didn't notice the implementation issue. Merging as-is.

The Cloudflare console config on our side might also be off, so we'll take a look as a follow-up.

@yamadashy yamadashy merged commit f458fbd into yamadashy:main May 24, 2026
24 checks passed
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.

Cloudflare Turnstile reports invalid 'size'

2 participants