Skip to content

fix(input-otp): prevent deletion when readonly is true#30983

Open
KanhaiyaPandey wants to merge 1 commit intoionic-team:mainfrom
KanhaiyaPandey:fix/input-otp-readonly-interaction
Open

fix(input-otp): prevent deletion when readonly is true#30983
KanhaiyaPandey wants to merge 1 commit intoionic-team:mainfrom
KanhaiyaPandey:fix/input-otp-readonly-interaction

Conversation

@KanhaiyaPandey
Copy link

Closes #30913

Description

When ion-input-otp has the readonly prop set, typing is correctly blocked but users are still able to delete characters using the Backspace or Delete keys.

This PR ensures that all keyboard interactions that modify the value are prevented when readonly is true.

Changes

  • Added guard for readonly inside keydown handler
  • Prevented default behavior for Backspace and Delete
  • Ensured no value mutation occurs in readonly mode

How to Test

  1. Add readonly to ion-input-otp
  2. Attempt to type → no input allowed
  3. Press Backspace/Delete → no characters removed

Behavior now matches expected readonly semantics.

@KanhaiyaPandey KanhaiyaPandey requested a review from a team as a code owner March 1, 2026 07:51
@vercel
Copy link

vercel bot commented Mar 1, 2026

@KanhaiyaPandey is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the package: core @ionic/core package label Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: input-otp readonly doesn't disable delete

1 participant