We are currently in the process of maintenance for IE11 in the service.
- There are two forms that raise an alert on focusout.
- In this case, let's call the two forms A_form and B_form.
- After clicking A_form, select B_form.
- At this time, focusout occurs in A_form and an alert is raised.
- After clicking OK on the alert, click a_form.
- (Error) If there are multiple windows in the window, the window with the form is pushed back.
I am in the same situation as above. Why are you doing this? Any help would be appreciated. Thank. I didn't speak English well, so I used a translator. Please understand the clumsy context. It only happens in IE11. I tested firefox, chrome and edge.
My development environment is as follows : windows10, IE11 The sample code below is attached.
function A_alert() {
alert("a_form alert");
}
function B_alert() {
alert("b_form alert");
}
<input id="a_form" type="text" onfocusout="A_alert()">
<input id="b_form" type="password" onfocusout="B_alert()">
console.log():
a_form : mouse down a_form : focus a_form : mouse up a_form : click b_form : mouse down a_form : focus out b_form : mouse up a_alert : ok a_form : blur b_form : focus b_form : focus out b_alert :raised error
alert
loop on Chromium-based browsers (as of this writing).alert
onfocusout
is a fundamental no-no.alert
and focus interact in unfortunate ways that vary from browser to browser, andalert
is horrible user experience. The solution here is to not usealert
for whatever you're trying to tell the users. (Before you say [as people often do] "But it's the requirement" -- too bad. :-D Tell the person making the requirements it's not feasible and maintainable.)console.log
instead ofalert
.alert
is triggered only whendocument.activeElement
isnull
. This avoids endlessalert
loops.