Skip to content

feat(ui): Add dragging to keyless prompt#7845

Merged
alexcarpenter merged 3 commits intomainfrom
alexcarpenter/keyless-prompt-dragging-2
Feb 14, 2026
Merged

feat(ui): Add dragging to keyless prompt#7845
alexcarpenter merged 3 commits intomainfrom
alexcarpenter/keyless-prompt-dragging-2

Conversation

@alexcarpenter
Copy link
Member

@alexcarpenter alexcarpenter commented Feb 13, 2026

Description

Screen.Recording.2026-02-13.at.1.56.46.PM.mov

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:

Summary by CodeRabbit

  • New Features

    • Added drag-to-corner interaction to KeylessPrompt with smooth animations and position persistence.
  • Tests

    • Expanded test coverage for drag-to-corner utilities and behaviors.
  • Chores

    • Added a changeset entry documenting a patch bump and the new drag-to-corner feature.
  • Style

    • Removed right-to-left HTML attribute in the sandbox template (affects page direction handling).

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 13, 2026 7:28pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

🦋 Changeset detected

Latest commit: a54f6b3

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

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension 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

Comment on lines -2 to -5
<html
class="h-full"
dir="rtl"
>
Copy link
Member Author

Choose a reason for hiding this comment

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

Left over debugging that should have been removed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds drag-to-corner behavior for the KeylessPrompt: a new React hook useDragToCorner implements pointer-based dragging, velocity sampling, projection, snap-to-corner animation, and persistence. The KeylessPrompt component is updated to use the hook, apply corner styles, and guard clicks during drag. Unit tests for the drag utilities and velocity logic are added. A changelog changeset documents the feature. The sandbox template HTML had its dir="rtl" attribute removed.

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (10 files):

⚔️ integration/presets/longRunningApps.ts (content)
⚔️ integration/templates/react-vite/src/buttons/index.tsx (content)
⚔️ integration/templates/react-vite/src/main.tsx (content)
⚔️ integration/tests/oauth-flows.test.ts (content)
⚔️ packages/clerk-js/sandbox/template.html (content)
⚔️ packages/ui/src/components/devPrompts/KeylessPrompt/__tests__/KeylessPrompt.test.tsx (content)
⚔️ packages/ui/src/components/devPrompts/KeylessPrompt/index.tsx (content)
⚔️ packages/ui/src/hooks/index.ts (content)
⚔️ packages/ui/src/router/BaseRouter.tsx (content)
⚔️ packages/ui/src/router/PathRouter.tsx (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ui): Add dragging to keyless prompt' directly and clearly summarizes the main change—adding drag-to-corner functionality to the KeylessPrompt component.

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


No actionable comments were generated in the recent review. 🎉


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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 13, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7845

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7845

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7845

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7845

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7845

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7845

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7845

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7845

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7845

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7845

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7845

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7845

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7845

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7845

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7845

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7845

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7845

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7845

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7845

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7845

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7845

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7845

commit: a54f6b3

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.ts`:
- Around line 34-72: The file references React types (React.CSSProperties,
React.RefObject, PointerEventHandler) in the UseDragToCornerResult interface and
functions like getNearestCorner and getCornerStyles but doesn't import them; add
a type-only import from react (e.g. import type { CSSProperties, RefObject,
PointerEventHandler } from 'react') and update the interface/type annotations to
use CSSProperties and RefObject/PointerEventHandler so TypeScript with
allowUmdGlobalAccess disabled will compile.

Comment on lines 34 to 72
interface UseDragToCornerResult {
corner: Corner;
isDragging: boolean;
cornerStyle: React.CSSProperties;
containerRef: React.RefObject<HTMLDivElement>;
onPointerDown: PointerEventHandler;
preventClick: boolean;
isInitialized: boolean;
}

export function getNearestCorner(projectedTranslation: Point, corners: Record<Corner, Point>): Corner {
let nearestCorner: Corner = 'bottom-right';
let minDistance = Infinity;

for (const [corner, translation] of Object.entries(corners)) {
const dx = projectedTranslation.x - translation.x;
const dy = projectedTranslation.y - translation.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < minDistance) {
minDistance = distance;
nearestCorner = corner as Corner;
}
}

return nearestCorner;
}

export function getCornerStyles(corner: Corner): React.CSSProperties {
switch (corner) {
case 'top-left':
return { top: CORNER_OFFSET, left: CORNER_OFFSET };
case 'top-right':
return { top: CORNER_OFFSET, right: CORNER_OFFSET };
case 'bottom-left':
return { bottom: CORNER_OFFSET, left: CORNER_OFFSET };
case 'bottom-right':
return { bottom: CORNER_OFFSET, right: CORNER_OFFSET };
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, read the entire file to see imports and actual usage
cat -n packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.ts

Repository: clerk/javascript

Length of output: 18612


🏁 Script executed:

# Check tsconfig for allowUmdGlobalAccess
find . -name "tsconfig*.json" -type f | head -5 | xargs grep -l "allowUmdGlobalAccess" 2>/dev/null || echo "No allowUmdGlobalAccess found"
cat tsconfig.json 2>/dev/null | grep -A5 -B5 "allowUmdGlobalAccess" || echo "Setting not found in root tsconfig"

Repository: clerk/javascript

Length of output: 124


🏁 Script executed:

# Also check for compilerOptions in the packages/ui directory
find packages/ui -name "tsconfig*.json" -type f | head -3 | xargs cat

Repository: clerk/javascript

Length of output: 1084


Fix missing React type imports to prevent compilation errors.

Lines 37–38 and 61 reference React.CSSProperties and React.RefObject without importing the React namespace or these types. With allowUmdGlobalAccess disabled (not found in tsconfig), this will fail TypeScript compilation.

Import both types directly:

Suggested fix
-import type { PointerEventHandler } from 'react';
+import type { CSSProperties, PointerEventHandler, RefObject } from 'react';
 import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
@@
 interface UseDragToCornerResult {
   corner: Corner;
   isDragging: boolean;
-  cornerStyle: React.CSSProperties;
-  containerRef: React.RefObject<HTMLDivElement>;
+  cornerStyle: CSSProperties;
+  containerRef: RefObject<HTMLDivElement>;
   onPointerDown: PointerEventHandler;
   preventClick: boolean;
   isInitialized: boolean;
 }
@@
-export function getCornerStyles(corner: Corner): React.CSSProperties {
+export function getCornerStyles(corner: Corner): CSSProperties {
🤖 Prompt for AI Agents
In `@packages/ui/src/components/devPrompts/KeylessPrompt/use-drag-to-corner.ts`
around lines 34 - 72, The file references React types (React.CSSProperties,
React.RefObject, PointerEventHandler) in the UseDragToCornerResult interface and
functions like getNearestCorner and getCornerStyles but doesn't import them; add
a type-only import from react (e.g. import type { CSSProperties, RefObject,
PointerEventHandler } from 'react') and update the interface/type annotations to
use CSSProperties and RefObject/PointerEventHandler so TypeScript with
allowUmdGlobalAccess disabled will compile.

Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

this is awesome! thanks 🚀

@alexcarpenter alexcarpenter merged commit 2627442 into main Feb 14, 2026
41 checks passed
@alexcarpenter alexcarpenter deleted the alexcarpenter/keyless-prompt-dragging-2 branch February 14, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants