Fixed cannot backspace when form is focused.

This commit is contained in:
Sean Li 2015-02-24 12:23:49 -08:00
parent 13b829ba5f
commit f401c97001
1 changed files with 11 additions and 0 deletions

View File

@ -51,7 +51,18 @@ Menu.setApplicationMenu(menu);
document.onkeydown = function (e) {
e = e || window.event;
var doPrevent;
if (e.keyCode === 8) {
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() === 'INPUT' || d.tagName.toUpperCase() === 'TEXTAREA') {
doPrevent = d.readOnly || d.disabled;
} else {
doPrevent = true;
}
} else {
doPrevent = false;
}
if (doPrevent) {
e.preventDefault();
}
};