nuxt / nuxt/ui

PinInput: Add sequential fill mode to prevent gaps

Open
#5,417 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

upstream/reka-ui
Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Package

v4.x

Description

In PinInput, users can click any later cell and type there, leaving gaps in earlier cells. This creates inconsistent values (with “holes”), adds validation complexity, and can confuse users, especially for OTP/verification flows where sequential entry is expected.

Describe the solution you'd like

Add a prop to enforce sequential entry and redirect focus to the first empty cell whenever a user attempts to focus a later cell while there are empty cells before it.

Proposed API (either form works):

// Option A (boolean)
enforceSequential?: boolean // default: false

// Option B (enum)
fillOrder?: 'free' | 'sequential' // default: 'free'

Expected behavior when sequential mode is enabled:

  • Clicking any cell while there are earlier empty cells focuses the first empty cell instead.
  • Typing auto-advances to the next cell as usual.
  • Backspace on an empty cell moves focus back to the previous filled cell (typical OTP UX).
  • Pasting multiple characters fills from the first empty cell sequentially (extra characters are ignored if exceeding length).
  • When all earlier cells are filled, focusing/typing in later cells works as normal.
Describe alternatives you've considered
  • Manually intercepting focus, click, keydown, and paste to re-route focus and manage value spread. This is repetitive, error-prone, and easy to miss edge cases (IME, selection, paste overflow).
Additional context

This aligns with common OTP/verification UX where users expect left-to-right, gap-free entry. The feature is non-breaking if the default remains the current “free” behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the PinInput component and its current focus, keyboard, and paste handling. Compare the proposed API options and verify that free behavior remains the default; done means sequential focus, typing, backspace, paste, and overflow cases behave as described, with coverage for those interactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.