Skip to content

fix(pin-input): focus first empty slot on empty-field click#3014

Open
SergioChan wants to merge 1 commit intochakra-ui:mainfrom
SergioChan:fix-pin-input-focus-first-empty
Open

fix(pin-input): focus first empty slot on empty-field click#3014
SergioChan wants to merge 1 commit intochakra-ui:mainfrom
SergioChan:fix-pin-input-focus-first-empty

Conversation

@SergioChan
Copy link

@SergioChan SergioChan commented Mar 7, 2026

Closes #2999

📝 Description

  • update setFocusedIndex to route focus to the first empty pin slot when the clicked input is empty
  • keep existing behavior for clicks on already-filled inputs

⛳️ Current behavior (updates)

  • clicking an empty slot focuses that exact slot, even when earlier slots are still empty
  • this can make keyboard entry start from the middle and leave earlier cells unfilled

🚀 New behavior

  • clicking any empty slot now moves focus to the first empty slot in the group
  • clicking a filled slot still focuses the clicked slot

💣 Is this a breaking change (Yes/No):

No

📝 Additional Information

Validated locally with:

  • pnpm --filter @zag-js/pin-input lint
  • pnpm --filter @zag-js/pin-input typecheck

@changeset-bot
Copy link

changeset-bot bot commented Mar 7, 2026

⚠️ No Changeset found

Latest commit: f37744f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Mar 7, 2026

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

Project Deployment Actions Updated (UTC)
zag-nextjs Ready Ready Preview Mar 7, 2026 4:15pm
zag-solid Ready Ready Preview Mar 7, 2026 4:15pm
zag-svelte Ready Ready Preview Mar 7, 2026 4:15pm
zag-vue Ready Ready Preview Mar 7, 2026 4:15pm
zag-website Ready Ready Preview Mar 7, 2026 4:15pm

Request Review

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.

Clicking any PinInput.Input should focus the first Input when empty

1 participant