From 9871e438e8b91eab06206adcea09f7b763460399 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Wed, 12 Feb 2020 10:59:55 +0200 Subject: [PATCH] bind backspace key to back button --- src/services/KeyboardNavigation/KeyboardNavigation.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/services/KeyboardNavigation/KeyboardNavigation.js b/src/services/KeyboardNavigation/KeyboardNavigation.js index bd46169d2..cfcfe58f3 100644 --- a/src/services/KeyboardNavigation/KeyboardNavigation.js +++ b/src/services/KeyboardNavigation/KeyboardNavigation.js @@ -12,6 +12,14 @@ function KeyboardNavigation() { if (tab) { event.preventDefault(); window.location = tab.href; + return; + } + + if (event.target.tag !== 'INPUT') { + if (event.key === 'Backspace') { + window.history.back(); + return; + } } } function start() {