From 78506acd20ad571caf28845bbcdba8b518b26675 Mon Sep 17 00:00:00 2001 From: Jeff Arnold Date: Tue, 8 Jan 2013 11:25:17 -0500 Subject: [PATCH] Do not send the browser back on backspace when send button focused Fixes Trac #585 (imported from commit 2b5a02db66cc09ae41da7e6921a31a14c49cf811) --- zephyr/static/js/hotkey.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index 7396ae40d2..888c107517 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -29,6 +29,13 @@ function process_hotkey(e) { if (ui.home_tab_obscured()) return false; + // In browsers where backspace sends the browser back (e.g. Mac Chrome), + // do not go back if the send button is in focus + if ($('#compose-send-button:focus').length > 0 && code === 8) { + e.preventDefault(); + return false; + } + // Process hotkeys specially when in an input, textarea, or send button if ($('input:focus,textarea:focus,#compose-send-button:focus').length > 0) { if (code === 27) {