RESOLVED FIXED Bug 267569
Quirks: ceac.state.gov requires document.activeElement to be HTMLInputElement
https://bugs.webkit.org/show_bug.cgi?id=267569
Summary Quirks: ceac.state.gov requires document.activeElement to be HTMLInputElement
Karl Dubost
Reported 2024-01-16 00:12:25 PST
There is a webcompat issue created by a different behavior in between Firefox/Chrome on one side and Safari on the other side related to the way the OS is built. It would be great if ceac.state.gov fixes the issue, but in the mean time, there is probably a need for a Quirk to solve it. This is related to Bug 267449 `document.activeElement` for an `onclick` on a `<input type=checkbox>` returns HTMLBodyElement instead of HTMLInputElement There is a beforeunload if (window.addEventListener) { window.addEventListener("beforeunload", ClearSession, false); } else if (window.attachEvent) { window.attachEvent("onbeforeunload", ClearSession) } It fires a ClearSession. Which triggers else if (document.location.pathname.indexOf("Default.aspx") < 0 && typeof document.activeElement != "undefined" && document.activeElement.toString().indexOf("HTMLBodyElement") > 0 || document.activeElement.toString().indexOf("HTMLInputElement") > 0) { validNavigation = false; } And triggers: this.ExitClearSession() Which triggers the e.preventDefault() if (validNavigation == false && e != undefined) { if (ieMode == "True") { e.returnValue = undefined; } else { e.preventDefault(); } And when the return is happening at the end of ClearSession it opens the alert. Firefox in the clear session is } else if ((typeof document.activeElement != "undefined" && document.activeElement != "object" && typeof document.activeElement.name != "undefined") && ( document.activeElement.toString().indexOf("aspx") > 0 || //for the left menu exclusion document.activeElement.name.indexOf("btn") > 0 || //check for button click document.activeElement.name.indexOf("Button") > 0 || document.activeElement.type == "button") || document.activeElement.id.indexOf("cbx") > 0 || document.activeElement.id.indexOf("Radio") > 0 || document.activeElement.id.indexOf("radio") > 0 || document.activeElement.id.indexOf("chkbx") > 0 || document.activeElement.id.indexOf("Button") > 0 || document.activeElement.id.indexOf("button") > 0) { // for button validNavigation = true; Firefox: document.activeElement is input Safari: document.activeElement is body This will decide if validNavigation is true or false And then will make WebKit fail for the next step. For the purpose of this quirk, it is necessary that the document.activeElement returns HTMLInputElement at this stage. This is not the first time that there is an issue with this site. And probably the previous Quirks was done to solve this issue but this is not working anymore. See Bug 193478 https://searchfox.org/wubkat/rev/581e116dc6ce254811dbe2da9d1c1168762fc30c/Source/WebCore/page/Quirks.cpp#130-141
Attachments
Karl Dubost
Comment 1 2024-01-16 00:12:47 PST
Karl Dubost
Comment 2 2024-01-16 23:53:32 PST
EWS
Comment 3 2024-01-21 18:11:40 PST
Committed 273282@main (0b543cc9ff31): <https://commits.webkit.org/273282@main> Reviewed commits have been landed. Closing PR #22854 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.