New issue
Advanced search Search tips

Issue 746755 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 703407
Owner: ----
Closed: Jul 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



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.
 

Comment 1 by kochi@chromium.org, Jul 20 2017

I copied the example above to jsbin, and you can play with
http://output.jsbin.com/yazizarime

(source: http://jsbin.com/yazizarime/edit?html )

Comment 2 by kochi@chromium.org, Jul 20 2017

Mergedinto: 703407
Status: Duplicate (was: Unconfirmed)
Components: Blink>HTML>Focus
Components: -Blink>Focus

Sign in to add a comment