Browse Source

Go back only if focused input is empty

master
Kenneth Bruen 2 years ago
parent
commit
6095314341
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 2
      back.js

2
back.js

@ -1,6 +1,6 @@
window.addEventListener('load', function (e) {
this.document.body.addEventListener('keydown', function (e) {
if (e.key == 'Backspace') {
if (e.key == 'Backspace' && (e.target.tagName.toUpperCase() !== 'INPUT' || e.target.value.length === 0)) {
e.preventDefault()
window.history.back()
}

Loading…
Cancel
Save