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: Fix clicking on elements inside links.

Tim Abbott606c2acefe62
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index ad1ac860f2a..279519ba5fa 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -71,7 +71,9 @@ exports.initialize = function () {
function is_clickable_message_element(target) {
// This function defines all the elements within a message
// body that have UI behavior other than starting a reply.
- if (target.is("a")) {
+
+ // Links should be handled by the browser.
+ if (target.closest('a').length > 0) {
return true;
}
@@ -100,12 +102,6 @@ exports.initialize = function () {
return true;
}
- // Arguably this should just be the second condition, but this
- // case is for when possible for a link is split by search highlight syntax.
- if (target.is(".highlight") && target.parent().is("a")) {
- return true;
- }
-
return false;
}
diff --git a/static/js/spoilers.js b/static/js/spoilers.js
index b343a3fff2a..866061c0c9e 100644
--- a/static/js/spoilers.js
+++ b/static/js/spoilers.js
@@ -43,7 +43,7 @@ exports.initialize = function () {
// Spoiler headers can contain markdown, including links. We
// return so that clicking such links will be be processed by
// the browser rather than opening the header.
- if (target.is('a')) {
+ if (target.closest('a').length > 0) {
return;
}