Skip to content

fix(pinCodeInput): delete previous digit instantly on backspace#736

Merged
AhmedAmineZr merged 3 commits into
Orange-OpenSource:developfrom
theamiri:735-pin-code-input-instant-backspace
May 8, 2026
Merged

fix(pinCodeInput): delete previous digit instantly on backspace#736
AhmedAmineZr merged 3 commits into
Orange-OpenSource:developfrom
theamiri:735-pin-code-input-instant-backspace

Conversation

@theamiri
Copy link
Copy Markdown
Contributor

@theamiri theamiri commented May 7, 2026

Related issues

Closes #735

Description

Fixes a UX defect in OudsPinCodeInput where deleting the most-recently-typed digit required two backspace presses instead of one: the first press only moved focus to the previous cell, the second press finally deleted the character.

After this change, a single backspace on an empty cell does both in one step:

  1. The previous cell's content is cleared (instead of waiting for the underlying TextField to handle a second keystroke).
  2. Focus moves to that previous cell.

The cleanup is lifted up to OudsPinCodeInput (which has access to the full controller list and focus nodes) via a new optional onBackspaceOnEmpty callback on OudsDigitInput. The handler:

  • Skips silently if index == 0 or the controllers/focus-nodes lists are out of bounds.
  • Re-emits onChanged with the truncated PIN only when the previous cell actually held a character (no spurious notifications when walking back through empty cells).

Behavior on a non-empty cell is unchanged — the underlying TextField still handles in-cell deletion on the first press as before.

Motivation & Context

Standard PIN-code UX (system keypads, banking apps) deletes the previous digit on a single backspace. The current two-press behavior breaks user muscle memory and makes the component feel laggy when correcting typos. The earlier implementation only called previousFocus() on an empty cell and relied on the next keystroke for the actual deletion.

Types of change

  • Bug fix (non-breaking which fixes an issue)

Previews

Checklist

Contribution

Accessibility

  • My change follows accessibility good practices

Design

  • My change respects the design guidelines of Orange Unified Design System

Development

  • My change follows the developer guide
  • (NA) I have added unit tests to cover my changes (optional)

Documentation

  • (NA) My change introduces changes to the documentation and/or I have updated the documentation accordingly

Checklist (for Core Team only)

  • Manually test (dark mode, RTL, landscape display, tablet)
  • Documentation has been updated if relevant
  • Design review
  • A11y review
  • Internal files have been updated if relevant (THIRD_PARTY, NOTICE)
  • CHANGELOG.md files have been updated respecting keep a changelog rules and referencing the issue

@AhmedAmineZr
Copy link
Copy Markdown
Member

update changelog with number of ticket and update the branch

@AhmedAmineZr AhmedAmineZr added 🐞 bug Something isn't working 📖 documentation Improvements or additions to documentation ⚛️ component 📱 demo app 🧰 library labels May 8, 2026
abdelghafour amiri added 2 commits May 8, 2026 11:49
# Conflicts:
#	ouds_core/lib/components/pin_code_input/digit_input/ouds_digit_input.dart
@theamiri theamiri force-pushed the 735-pin-code-input-instant-backspace branch from 8cbd6dd to 8d872ca Compare May 8, 2026 10:52
@theamiri
Copy link
Copy Markdown
Contributor Author

theamiri commented May 8, 2026

Hi,

The two PRs are already open in Orange-OpenSource/ouds-flutter:

Both target develop, both have the CHANGELOG entry, both are now mergeable after the rebase you asked for.

What you're probably seeing is that the source branches live on my fork (theamiri/ouds-flutter) — that's because my account only has read access on the org repo (verified: permissions: { pull: true, push: false }), so GitHub's standard external-contributor flow is "branch on fork → PR upstream". The PRs themselves are in your repo and behave exactly like internal ones for review and merge.

If you'd prefer the branches to live directly inside Orange-OpenSource/ouds-flutter, you'd need to grant me Write/Triage on the repo and I'll push them over. Otherwise there's nothing else to create — let me know if I'm missing something.

Thanks,
Amir

@AhmedAmineZr AhmedAmineZr merged commit 22d7c13 into Orange-OpenSource:develop May 8, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working ⚛️ component 📱 demo app 📖 documentation Improvements or additions to documentation 🧰 library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PinCodeInput: deletion requires two backspace presses on a typed digit

2 participants