Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent_view: Pin mark-as-read tooltip placement per row.
Aman Agrawal160e4cbc0e8f
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.tsindex eb19b4ec579..dc55223e3ab 100644--- a/web/src/tippyjs.ts+++ b/web/src/tippyjs.ts@@ -1029,6 +1029,35 @@ export function initialize(): void {},});+ tippy.delegate("body", {+ target: "#recent-view-content-tbody .on_hover_topic_read",+ popperOptions: {+ modifiers: [+ {+ // We pick the placement explicitly per row in+ // onShow below, so disable Popper's automatic+ // flipping by providing no fallback placements.+ name: "flip",+ options: {+ fallbackPlacements: [],+ },+ },+ ],+ },+ onShow(instance) {+ // The first row's tooltip would overflow the top of the+ // recent view, so we place it to the left instead. All+ // other rows' tooltips are placed on top.+ const is_first_row =+ $(instance.reference).closest("#recent-view-content-tbody tr:first-child").length >+ 0;+ instance.setProps({placement: is_first_row ? "left" : "top"});+ },+ onHidden(instance) {+ instance.destroy();+ },+ });+tippy.delegate("body", {target: ".recent-view-conversation-link",delay: LONG_HOVER_DELAY,diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbsindex 12b96aa67b9..dad3b400a0c 100644--- a/web/templates/recent_view_row.hbs+++ b/web/templates/recent_view_row.hbs@@ -36,13 +36,13 @@<span class="unread_mention_info tippy-zulip-tooltip {{#unless has_unread_mention}}unread_hidden{{/unless}}"data-tippy-content="{{t 'You have unread mentions' }}">@</span><div class="recent_topic_actions recent-view-unread-count-wrapper">- <span class="unread_count unread_count_pm recent-view-table-unread-count recent_view_focusable {{#if (eq unread_count 0)}}unread_hidden{{/if}} tippy-zulip-tooltip on_hover_topic_read" data-user-ids-string="{{user_ids_string}}" data-tippy-content="{{t 'Mark as read' }}" role="button" aria-label="{{t 'Mark as read' }}" data-col-index="{{ column_indexes.read }}" tabindex="0">{{unread_count}}</span>+ <span class="unread_count unread_count_pm recent-view-table-unread-count recent_view_focusable {{#if (eq unread_count 0)}}unread_hidden{{/if}} on_hover_topic_read" data-user-ids-string="{{user_ids_string}}" data-tippy-content="{{t 'Mark as read' }}" role="button" aria-label="{{t 'Mark as read' }}" data-col-index="{{ column_indexes.read }}" tabindex="0">{{unread_count}}</span></div>{{else}}<span class="unread_mention_info tippy-zulip-tooltip {{#unless mention_in_unread}}unread_hidden{{/unless}}"data-tippy-content="{{t 'You have unread mentions'}}">@</span><div class="recent_topic_actions recent-view-unread-count-wrapper">- <span class="unread_count recent-view-table-unread-count hidden-for-spectators recent_view_focusable {{#if (eq unread_count 0)}}unread_hidden{{/if}} tippy-zulip-tooltip on_hover_topic_read" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as read' }}" role="button" aria-label="{{t 'Mark as read' }}" data-col-index="{{ column_indexes.read }}" tabindex="0">{{unread_count}}</span>+ <span class="unread_count recent-view-table-unread-count hidden-for-spectators recent_view_focusable {{#if (eq unread_count 0)}}unread_hidden{{/if}} on_hover_topic_read" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as read' }}" role="button" aria-label="{{t 'Mark as read' }}" data-col-index="{{ column_indexes.read }}" tabindex="0">{{unread_count}}</span></div>{{/if}}</div>