Skip to content

Accessibility

Vue OTP Pro is built with accessibility in mind. Here's what's included out of the box.

ARIA Support

  • The container has role="group" to indicate it's a collection of related inputs
  • Each input has an aria-label like "OTP Input digit 1", "OTP Input digit 2", etc.
  • Customize the label prefix via the ariaLabel prop
vue
<OtpInput aria-label="Verification code" />
<!-- Produces: "Verification code digit 1", "Verification code digit 2", ... -->

Keyboard Navigation

KeyAction
0-9Enter digit, auto-advance to next
A-ZEnter letter (letter-numeric mode)
BackspaceClear current or move to previous
DeleteClear current input
ArrowLeftMove focus to previous input
ArrowRightMove focus to next input
TabStandard tab navigation
EnterTriggers complete event if all filled
Ctrl/Cmd + VPaste from clipboard

Focus Management

  • Focus auto-advances when a digit is entered
  • Focus moves back on backspace when current input is empty
  • shouldAutoFocus prop focuses the first input on mount
  • shouldFocusOrder enforces sequential input — users can't skip ahead

Screen Readers

Each input is announced with its position:

"OTP Input digit 1" → "OTP Input digit 2" → ...

The autocomplete="one-time-code" attribute helps password managers and mobile browsers auto-fill OTP codes.

Mobile

  • inputmode="numeric" shows the numeric keyboard on mobile
  • iOS SMS autofill is supported via autocomplete="one-time-code"
  • Paste handling strips delimiters automatically
  • IME (Chinese, Japanese, Korean) composition is validated on completion

Color Contrast

All built-in themes meet WCAG AA contrast requirements for text and borders. The focus ring provides a visible indicator for keyboard users.

Disabled vs Readonly

StateUser interactionAppearance
NormalFull inputStandard
disabledNo interaction45% opacity, not-allowed cursor
readonlyFocus/select only70% opacity, default cursor