Skip to content

Conversation

@alexcarpenter
Copy link
Member

@alexcarpenter alexcarpenter commented Nov 25, 2025

Description

Removing tabIndex={-1} usage to ensure buttons are keyboard accessible.

Resolves USER-4078

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

  • Bug Fixes

    • Improved keyboard accessibility: copy-to-clipboard and password visibility toggle are now keyboard-focusable and reachable via Tab navigation.
  • New Features

    • Password input now accepts a configurable tabIndex so developers can control focus order and align keyboard navigation with form flow.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: 08771b8

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 Nov 25, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Nov 25, 2025 9:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

Patch for @clerk/clerk-js: removes hardcoded tabIndex={-1} from the ClipboardInput copy button and makes PasswordInput accept and forward a tabIndex prop to its inner Input and show/hide IconButton, restoring keyboard focusability. Changeset file added.

Changes

Cohort / File(s) Summary
Changeset file
.changeset/five-animals-pull.md
New patch changeset declaring the accessibility update and patch release
Clipboard button
packages/clerk-js/src/ui/elements/ClipboardInput.tsx
Removed tabIndex={-1} from the copy-to-clipboard Button, re-enabling natural keyboard focus
Password input
packages/clerk-js/src/ui/elements/PasswordInput.tsx
PasswordInput now accepts a tabIndex prop (public API change) and forwards it to the inner Input and the show/hide IconButton, replacing the prior tabIndex={-1}

Sequence Diagram(s)

(Skipped — change is an accessibility prop/markup update without new control-flow or async interactions.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review highlights:
    • PasswordInput public API now accepts tabIndex — verify TypeScript prop typings and any exported prop types.
    • Ensure forwarding to Input and IconButton preserves behavior when tabIndex is undefined.
    • Confirm removal from ClipboardInput doesn't affect focus-management tests or automation.

Poem

🐰 I nudged a hidden key back in place,
Now fingers meet the button with grace.
A tiny hop, a kinder flow,
Tabs can wander — now they go. ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix(clerk-js): Ensure buttons have keyboard access when shown' directly and accurately summarizes the main change—removing tabIndex={-1} to restore keyboard accessibility.
Linked Issues check ✅ Passed The code changes successfully address USER-4078's requirement to remove tabIndex={-1} from keyboard-accessible buttons, restoring WCAG 2.1.1 compliance for the password field's show/hide button.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing keyboard accessibility in the password input and clipboard components by removing or making tabIndex configurable, which aligns with the linked issue requirement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch alexcarpenter/user-4078-hey-team-a-customer-is-reporting-a-wcag-issue-with-the

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e3e3aa3 and 1ccfb3b.

📒 Files selected for processing (1)
  • .changeset/five-animals-pull.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (33)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (nextjs, chrome, 15, RQ)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Static analysis
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, shared, clerk-js, RQ)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
.changeset/five-animals-pull.md (1)

5-5: Verify changeset message aligns with actual implementation.

The changeset message states "Conditionally apply tabIndex={-1} usage when shown," but the PR objectives and past review comment suggest the fix is to remove hardcoded tabIndex={-1} entirely. Without access to the modified component files (ClipboardInput.tsx and PasswordInput.tsx referenced in the AI summary), I cannot confirm whether this description accurately reflects the implementation.

Please clarify whether the changeset description matches the actual behavior:

  • Does the implementation conditionally apply tabIndex={-1} based on visibility state?
  • Or does it remove tabIndex={-1} and make tabIndex configurable via a prop?
  • Or is there a different approach?

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 25, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7306

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7306

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7306

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7306

@clerk/upgrade

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

@clerk/vue

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

commit: 08771b8

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: 0

🧹 Nitpick comments (1)
packages/clerk-js/src/ui/elements/PasswordInput.tsx (1)

23-36: tabIndex forwarding semantics for Input + IconButton

Forwarding tabIndex from PasswordInput to both the Input and the toggle IconButton cleanly removes the hardcoded tabIndex={-1} while making the show/hide button keyboard-focusable by default, which aligns with the WCAG issue being fixed.

One behavioral nuance to confirm: previously, a consumer‑provided tabIndex on PasswordInput would effectively control only the input (the toggle was always -1); now that same tabIndex applies to both Input and IconButton, giving the composite control two tab stops at that index. If this “two tab stops for a password field” model is the intended UX, the current implementation looks good. If instead you want to preserve the prior semantics (caller’s tabIndex only affecting the input while the toggle uses natural tab order), you could omit tabIndex on IconButton and rely on its default keyboard focusability.

Also applies to: 88-91, 107-114

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 215aeb4 and e3e3aa3.

📒 Files selected for processing (1)
  • packages/clerk-js/src/ui/elements/PasswordInput.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (11)
packages/clerk-js/src/ui/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/clerk-js-ui.mdc)

packages/clerk-js/src/ui/**/*.{ts,tsx}: Element descriptors should be written in camelCase
Use useCardState for card-level state management
Use useFormState for form-level state management
Use useLoadingStatus for managing loading states
Use useFormControl hook for form field state management with validation and localization support
All rendered values must be localized using useLocalizations hook - hard coded values are not allowed
Use localizationKeys for translating UI text with support for parameters and error messages
Use handleError utility for API error handling and provide field states for proper error mapping
Use the styled system sx prop with theme tokens for custom styling instead of inline styles
Use the Card component pattern with Card.Root, Card.Header, Card.Title, Card.Content, and Card.Footer for consistent card layouts
Use FormContainer with headerTitle and headerSubtitle localization keys combined with Form.Root and FormButtons for consistent form layouts
When form submission occurs, manage loading and error states by calling status.setLoading(), card.setLoading(), and card.setError() appropriately

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Prefer importing types from @clerk/shared/types instead of the deprecated @clerk/types alias

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components

**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{md,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Update documentation for API changes

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g., UserProfile, NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/clerk-js/src/ui/elements/PasswordInput.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan

@alexcarpenter alexcarpenter changed the title chore(clerk-js): Remove -1 tabIndex usage to ensure keyboard access fix(clerk-js): Ensure buttons have keyboard access when shown Nov 25, 2025
@alexcarpenter alexcarpenter merged commit d2a1345 into main Nov 25, 2025
44 checks passed
@alexcarpenter alexcarpenter deleted the alexcarpenter/user-4078-hey-team-a-customer-is-reporting-a-wcag-issue-with-the branch November 25, 2025 21:56
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.

4 participants