OLD | NEW |
---|---|
1 // Listen for the backspace key and go back if not in an editable field. | 1 // Listen for shift-backspace or unmodified backspace and navigate if not in |
2 // an editable field. | |
2 document.addEventListener('keydown', function(e) { | 3 document.addEventListener('keydown', function(e) { |
3 if (e.which === 8 && // backspace key code | 4 if (e.key === 'Backspace' && |
5 !e.altKey && | |
6 !e.ctrlKey && | |
7 !e.metaKey && | |
4 !isEditable(e.path)) { | 8 !isEditable(e.path)) { |
5 window.history.back(); | 9 e.shiftKey ? window.history.forward(): window.history.back(); |
6 e.preventDefault(); | 10 e.preventDefault(); |
7 } | 11 } |
8 }); | 12 }); |
OLD | NEW |