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.

click_handlers: Guard sidebar dragstart blur against non-elements.

Evy Kassirerec2568614139
diff --git a/web/src/click_handlers.ts b/web/src/click_handlers.ts
index 0082162fbc5..0a06113fe6f 100644
--- a/web/src/click_handlers.ts
+++ b/web/src/click_handlers.ts
@@ -1038,7 +1038,12 @@ export function initialize(): void {
// disable the draggability for left-sidebar components
$("#stream_filters, #left-sidebar-navigation-list").on("dragstart", (e) => {
- e.target.blur();
+ // e.target is the innermost node where the drag started, which is
+ // not necessarily an element with a blur() method; for instance,
+ // dragging a text selection makes it a Text node.
+ if (e.target instanceof HTMLElement) {
+ e.target.blur();
+ }
return false;
});