Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

shift_tab_key: Refactor process_shift_tab_key to use document.activeElement.

Raj Vishwakarmae52f5afb7f4f
diff --git a/web/src/hotkey.ts b/web/src/hotkey.ts
index 3001303ca11..8205945cf58 100644
--- a/web/src/hotkey.ts
+++ b/web/src/hotkey.ts
@@ -802,8 +802,13 @@ export function process_shift_tab_key(): boolean {
// Returns true if we handled it, false if the browser should.
// TODO: See if browsers like Safari can now handle tabbing correctly
// without our intervention.
+ const focused_element = document.activeElement;
+
+ if (!(focused_element instanceof HTMLElement)) {
+ return false;
+ }
- if ($("#compose-send-button").is(":focus")) {
+ if (focused_element.id === "compose-send-button") {
// Shift-Tab: go back to content textarea and restore
// cursor position.
compose_textarea.restore_compose_cursor();