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
- Navigate to the Registration page.
- Click on the LeetCode Username input.
- Try to type
leetcode.com/u/user.
- 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.
Problem Description
On
registration.html, the input field for LeetCode Username applies theextractUsernamevalidation on theinputevent 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
leetcode.com/u/user..or/, the character is deleted, resulting inleetcodecomuuser.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
extractUsernameon the input frominputtochangeorblurso that URL extraction triggers when the input loses focus. Keep thepasteevent listener as-is so users who copy-paste still see immediate formatting.