Issue metadata
Sign in to add a comment
|
onblur event handler can cause infinite browser loop
Reported by
webtesti...@gmail.com,
Jul 20 2017
|
||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Steps to reproduce the problem:
1. use basic sample code provided below in the what went wrong field to reproduce the problem
2. onblur event is called when User leaves field as expected
2. alert popup message displayed if field length is less than 2
3. user hits ok
4. focus is put on input field if expected criteria not met
5. everything works as expected
then...
1. uncomment basic sample code provided below to add another field and test the page again.
2. if the field does not meet the expected size, the message box is displayed again.
3. as soon as the User hits ok, the focus goes to the field, but the onblur event fires again before the User can make a change to the field
4. hitting OK makes the cycle continuously repeat making it impossible for the User to do anything but force the browser to close
console shows [Violation] 'blur' hanlder took number of ms each time the ok button is pressed
What is the expected behavior?
when the alert message box ok button is pressed, the field gets the focus, and the user can modify the field. The onblur event should not automatically execute when the field has focus.
What went wrong?
First Name: <input type="text" name="firstName" id="firstName" onblur="myGoogleTestFunction(this, 2);">
<!-- setup a test page, run it, then uncomment below field and test the page again to reproduce loop-->
<!--Last Name: <input type="text" name="lastName" id="lastName">-->
<script>
function myGoogleTestFunction(inputField, numreqchars) {
var fieldLength = inputField.value.length;
if (fieldLength < numreqchars) {
alert(inputField.name + " must be at least " + numreqchars + " characters long.");
inputField.focus();
}
}
</script>
Did this work before? Yes not sure of exact chrome version when this bug was introduced
Does this work in other browsers? Yes
Chrome version: 59.0.3071.115 Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
This has been reported before and was tagged with a WontFixing this for issue 666205 . Any change to a browser's functionality that causes the browser to be in a state that the User has no control over should be fixed, especially since it breaks older code.
,
Jul 20 2017
,
Sep 29 2017
,
Sep 29 2017
|
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by kochi@chromium.org
, Jul 20 2017