Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State refactor #94

Merged
merged 13 commits into from
Jan 7, 2025
Merged

State refactor #94

merged 13 commits into from
Jan 7, 2025

Conversation

soywod
Copy link
Owner

@soywod soywod commented Jan 7, 2025

The React <StrictMode> revealed inconsistency in the actual implementation. A deep refactor was needed, with the following rules in mind:

  • The state should be the source of truth, so it can be easily tracked down. This implies to add information about current values, focused input etc.
  • The view (DOM) should reflect the state in a useEffect
  • The PIN field should perform the minimum interaction with HTML, DOM and browser.

The actual solution only relies onChange (which should be compatible on most of browsers), on composition events onCompositionStart and onCompositionEnd to prevent composed key to feed the field, and onKeyDown to only detect backspaces. It may fix #80.

@soywod soywod merged commit 306625f into master Jan 7, 2025
1 check passed
@soywod soywod deleted the state-refactor branch January 7, 2025 10:27
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.

AutoFill doesn't work correctly on Safari
1 participant