Skip to content

[UX] Aggressive validation makes typing LeetCode profile URL manually impossible in registration #286

Description

@yashvi-3106

Problem Description

On registration.html, the input field for LeetCode Username applies the extractUsername validation on the input event listener on every single keystroke.

While this works for copy-pasting, it strips out special characters (. and /) as the user types. Thus, a user trying to manually type a profile URL (e.g. leetcode.com/...) is blocked because typing . or / is immediately stripped.

Steps to Reproduce

  1. Navigate to the Registration page.
  2. Click on the LeetCode Username input.
  3. Try to type leetcode.com/u/user.
  4. Observe that as soon as you type . or /, the character is deleted, resulting in leetcodecomuuser.

Expected Behavior

The input validation should not aggressively format the text character-by-character while the user is actively typing a URL, but should still allow full URL extraction.

Proposed Solution

Change the event listener for extractUsername on the input from input to change or blur so that URL extraction triggers when the input loses focus. Keep the paste event listener as-is so users who copy-paste still see immediate formatting.

Metadata

Metadata

Assignees

Labels

FrontendTask mainly involving frontendlevel:intermediateIndicates the difficultytype:bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions