We have the following JS:
// Allows ESC key to kill the throbber.
if (esc_key) {
document.onkeydown = function(evt) {
evt = evt || window.event;
var isEscape = false;
if ("key" in evt) {
isEscape = evt.key == "Escape";
} else {
isEscape = evt.keyCode == 27;
}
if (isEscape) {
$('.page-load-progress-lock-screen').remove();
}
};
}
Problem is evt.key and evt.keyCode can unexpectedly create JS type coercion due to the == comparison operator. Seems quite obvious for evt.keyCode to only require an integer but it's far less obvious exactly what to do for evt.key since you can have Escape, Esc or possibly other things. This will need some research, but the idea is to switch to using the === operator.
Comments
Comment #2
anavarreComment #3
anavarreComment #4
anavarreComment #5
anavarreFor
evt.keyhttps://www.w3.org/TR/uievents-key/#keys-ui is interesting in that it looks to be offeringEscapeand only it.Problem is https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_V... also states in the UI keys notes:
So we need to account for either
EscapeorEsc.Comment #7
anavarreComment #8
dom. commentedPatch applies and work fine to me.
RTBC
Comment #10
anavarre