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.

inbox: Expand unread-count click target to the row-tall column.

Alya Abbotte46c0c3d9d7b
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index cf596a92888..5c7ec76ed11 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -2475,39 +2475,35 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}):
focus_clicked_list_element($elt);
});
- $("body").on("click", "#inbox-list .on_hover_dm_read", function (this: HTMLElement, e) {
- e.stopPropagation();
- e.preventDefault();
- const $elt = $(this);
- col_focus = COLUMNS.UNREAD_COUNT;
- focus_clicked_list_element($elt);
- const user_ids_string = $elt.attr("data-user-ids-string");
- if (user_ids_string) {
- // direct message row
- unread_ops.mark_pm_as_read(user_ids_string);
- }
- });
-
- $("body").on("click", "#inbox-list .on_hover_topic_read", function (this: HTMLElement, e) {
- e.stopPropagation();
- e.preventDefault();
- const $elt = $(this);
- col_focus = COLUMNS.UNREAD_COUNT;
- focus_clicked_list_element($elt);
- const user_ids_string = $elt.attr("data-user-ids-string");
- if (user_ids_string) {
- // direct message row
- unread_ops.mark_pm_as_read(user_ids_string);
- return;
- }
- const stream_id = Number($elt.attr("data-stream-id"));
- const topic = $elt.attr("data-topic-name");
- if (topic !== undefined) {
- unread_ops.mark_topic_as_read(stream_id, topic);
- } else {
- unread_ops.mark_stream_as_read(stream_id);
- }
- });
+ // Bound to the row-tall wrapper so the full vertical area of the
+ // unread-count column acts as a "mark as read" click target. Data
+ // attributes live on the inner badge.
+ $("body").on(
+ "click",
+ "#inbox-list .unread-count-focus-outline",
+ function (this: HTMLElement, e) {
+ e.stopPropagation();
+ e.preventDefault();
+ const $badge = $(this).find(".unread_count");
+ if ($badge.length === 0) {
+ return;
+ }
+ col_focus = COLUMNS.UNREAD_COUNT;
+ focus_clicked_list_element($(this));
+ const user_ids_string = $badge.attr("data-user-ids-string");
+ if (user_ids_string) {
+ unread_ops.mark_pm_as_read(user_ids_string);
+ return;
+ }
+ const stream_id = Number($badge.attr("data-stream-id"));
+ const topic = $badge.attr("data-topic-name");
+ if (topic !== undefined) {
+ unread_ops.mark_topic_as_read(stream_id, topic);
+ } else {
+ unread_ops.mark_stream_as_read(stream_id);
+ }
+ },
+ );
$("body").on("click", "#inbox-list .change_visibility_policy", function (this: HTMLElement) {
const $elt = $(this);
diff --git a/web/styles/inbox.css b/web/styles/inbox.css
index 9735726e20a..f7983b7d316 100644
--- a/web/styles/inbox.css
+++ b/web/styles/inbox.css
@@ -241,6 +241,19 @@
count from affecting overall row
size as test scales up. */
align-self: stretch;
+ /* Whole 30×stretched hit area is clickable; surface
+ the same pointer cursor users had on the smaller
+ badge before the click target was expanded. */
+ cursor: pointer;
+
+ /* Forward the badge's hover outline to the wrapper:
+ the click handler now lives on the wrapper, so
+ hovering anywhere in the wrapper (not just the
+ small inner badge) should preview the click
+ affordance. */
+ &:hover .unread_count {
+ outline-width: 1.5px;
+ }
}
.unread_mention_info {