message view: Fix tooltips in message action icons.

Tooltips in message action buttons for failed message were
not shown properly because they were initialized two times
first because of general tippy-zulip-tooltip class and then
because of message_control_button class. So to avoid showing
an extra empty tooltip for failed message icons we return
false from onShow() method of message_control_button class
initialization of tooltip.
This commit is contained in:
m-e-l-u-h-a-n 2021-05-21 02:06:56 +05:30 committed by Tim Abbott
parent 03a3879aa0
commit c97956c5ff
2 changed files with 11 additions and 2 deletions

View File

@ -92,7 +92,16 @@ export function initialize() {
const edit_button = elem.find("i.edit_content_button"); const edit_button = elem.find("i.edit_content_button");
content = edit_button.attr("data-tippy-content"); content = edit_button.attr("data-tippy-content");
} }
if (content === undefined) {
// If content is still undefined it is because content
// is specified on inner i tags and is handled by our
// general tippy-zulip-tooltip class. So we return
// false here to avoid showing an extra empty tooltip
// for such cases.
return false;
}
instance.setContent(content); instance.setContent(content);
return true;
}, },
}); });
} }

View File

@ -16,8 +16,8 @@
{{/unless}} {{/unless}}
<div class="message_failed message_control_button {{#unless msg.failed_request}}notvisible{{/unless}}"> <div class="message_failed message_control_button {{#unless msg.failed_request}}notvisible{{/unless}}">
<i class="fa fa-refresh refresh-failed-message tippy-zulip-tooltip" data-tippy-content="{{t 'Retry' }}" aria-label="{{t 'Retry' }}" role="button" tabindex="0"></i> <i class="fa fa-refresh refresh-failed-message tippy-zulip-tooltip" data-tippy-content="{{t 'Retry' }}" data-tippy-placement="top" aria-label="{{t 'Retry' }}" role="button" tabindex="0"></i>
<i class="fa fa-times-circle remove-failed-message tippy-zulip-tooltip" data-tippy-content="{{t 'Cancel' }}" aria-label="{{t 'Cancel' }}" role="button" tabindex="0"></i> <i class="fa fa-times-circle remove-failed-message tippy-zulip-tooltip" data-tippy-content="{{t 'Cancel' }}" data-tippy-placement="top" aria-label="{{t 'Cancel' }}" role="button" tabindex="0"></i>
</div> </div>
{{#unless msg/locally_echoed}} {{#unless msg/locally_echoed}}