Skip to content

Conversation

@anagstef
Copy link
Member

@anagstef anagstef commented Jan 17, 2025

Description

This PR fixes the layout shift caused by the Turnstile script, especially when in Smart mode there was no interactive challenge.

Before (Smart without interaction):

before.mp4

After (Smart without interaction):

after-invisible.mp4

After (Smart with interaction):

after-smart.mp4

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented Jan 17, 2025

🦋 Changeset detected

Latest commit: 69f7409

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2025 2:16pm

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 2.1.10-snapshot.v20250117141324
@clerk/backend 1.23.2-snapshot.v20250117141324
@clerk/chrome-extension 2.1.14-snapshot.v20250117141324
@clerk/clerk-js 5.45.1-snapshot.v20250117141324
@clerk/elements 0.22.10-snapshot.v20250117141324
@clerk/clerk-expo 2.6.13-snapshot.v20250117141324
@clerk/expo-passkeys 0.1.9-snapshot.v20250117141324
@clerk/express 1.3.37-snapshot.v20250117141324
@clerk/fastify 2.1.10-snapshot.v20250117141324
@clerk/localizations 3.9.10-snapshot.v20250117141324
@clerk/nextjs 6.9.13-snapshot.v20250117141324
@clerk/nuxt 1.0.6-snapshot.v20250117141324
@clerk/clerk-react 5.22.1-snapshot.v20250117141324
@clerk/react-router 0.2.0-snapshot.v20250117141324
@clerk/remix 4.4.12-snapshot.v20250117141324
@clerk/shared 2.20.9-snapshot.v20250117141324
@clerk/tanstack-start 0.8.11-snapshot.v20250117141324
@clerk/testing 1.4.10-snapshot.v20250117141324
@clerk/themes 2.2.8-snapshot.v20250117141324
@clerk/types 4.41.1-snapshot.v20250117141324
@clerk/ui 0.3.11-snapshot.v20250117141324
@clerk/vue 1.1.1-snapshot.v20250117141324

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@2.1.10-snapshot.v20250117141324 --save-exact

@clerk/backend

npm i @clerk/backend@1.23.2-snapshot.v20250117141324 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@2.1.14-snapshot.v20250117141324 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.45.1-snapshot.v20250117141324 --save-exact

@clerk/elements

npm i @clerk/elements@0.22.10-snapshot.v20250117141324 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@2.6.13-snapshot.v20250117141324 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@0.1.9-snapshot.v20250117141324 --save-exact

@clerk/express

npm i @clerk/express@1.3.37-snapshot.v20250117141324 --save-exact

@clerk/fastify

npm i @clerk/fastify@2.1.10-snapshot.v20250117141324 --save-exact

@clerk/localizations

npm i @clerk/localizations@3.9.10-snapshot.v20250117141324 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@6.9.13-snapshot.v20250117141324 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@1.0.6-snapshot.v20250117141324 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.22.1-snapshot.v20250117141324 --save-exact

@clerk/react-router

npm i @clerk/react-router@0.2.0-snapshot.v20250117141324 --save-exact

@clerk/remix

npm i @clerk/remix@4.4.12-snapshot.v20250117141324 --save-exact

@clerk/shared

npm i @clerk/shared@2.20.9-snapshot.v20250117141324 --save-exact

@clerk/tanstack-start

npm i @clerk/tanstack-start@0.8.11-snapshot.v20250117141324 --save-exact

@clerk/testing

npm i @clerk/testing@1.4.10-snapshot.v20250117141324 --save-exact

@clerk/themes

npm i @clerk/themes@2.2.8-snapshot.v20250117141324 --save-exact

@clerk/types

npm i @clerk/types@4.41.1-snapshot.v20250117141324 --save-exact

@clerk/ui

npm i @clerk/ui@0.3.11-snapshot.v20250117141324 --save-exact

@clerk/vue

npm i @clerk/vue@1.1.1-snapshot.v20250117141324 --save-exact

@anagstef anagstef self-assigned this Jan 17, 2025
@anagstef anagstef marked this pull request as ready for review January 17, 2025 14:19
@anagstef anagstef changed the title fix(clerk-js): Fix layout shift when Smart CAPTCHA is about to execute fix(clerk-js): Fix layout shift when Smart CAPTCHA executes an interactive challenge Jan 17, 2025
Comment on lines +177 to +178
visibleWidget.style.minHeight = '68px'; // this is the height of the Turnstile widget
visibleWidget.style.marginBottom = '1.5rem';
Copy link
Member Author

Choose a reason for hiding this comment

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

This utility does not have access to our UI design system, so we need to hardcode these values.

Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

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

❤️

@brkalow brkalow merged commit fdbcfd6 into main Jan 17, 2025
33 checks passed
@brkalow brkalow deleted the stefanos/fraud-200-prevent-layout-shift-during-captcha-rendering-in-sign-ups branch January 17, 2025 20:36
wobsoriano pushed a commit that referenced this pull request Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants