Skip to content

Invalid input alert triggered on backspace in empty or single-digit input #2042

@mayurrogheliya

Description

@mayurrogheliya

Describe the bug
In the Armstrong Number Checker project, when I focus on the input field and press backspace (with either no input or just one digit), it shows a browser alert saying “Invalid input.” This alert appears unnecessarily during normal text deletion.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Armstrong Number Checker project
  2. Focus on the number input field
  3. Type a single digit (or leave it empty)
  4. Press Backspace
  5. See the alert message: "Invalid input"

Expected behavior
The alert should not appear when the user is just deleting input (especially if it's empty or partially entered). Validation should only happen when there's actual input to evaluate.

Screenshots

Image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: Latest

Smartphone (please complete the following information):
Not tested on mobile

Additional context
Suggest using inline error message instead of alert(). This improves UX and avoids interrupting the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions