popovers: Close user popover when clicked on stream name.

Earlier, when a user clicked on any stream name from the
user_popover, the stream page would open in the background,
but the user popover wouldn't close.

Fixed it by explicitly binding it to a click handler,
which closes the user popover before redirecting to stream
page.
This commit is contained in:
aryanshridhar 2021-06-18 10:44:54 +00:00 committed by Tim Abbott
parent 4cff56a47c
commit 8cd9fc7a74
2 changed files with 8 additions and 1 deletions

View File

@ -1132,10 +1132,17 @@ export function register_click_handlers() {
e.preventDefault(); e.preventDefault();
}); });
/* These click handlers are implemented as just deep links to the
* relevant part of the Zulip UI, so we don't want preventDefault,
* but we do want to close the modal when you click them. */
$("body").on("click", "#user-profile-modal #name #edit-button", () => { $("body").on("click", "#user-profile-modal #name #edit-button", () => {
hide_user_profile(); hide_user_profile();
}); });
$("body").on("click", "#user-profile-modal .stream_list_item", () => {
hide_user_profile();
});
$("body").on("click", ".compose_mobile_button", function (e) { $("body").on("click", ".compose_mobile_button", function (e) {
show_mobile_message_buttons_popover(this); show_mobile_message_buttons_popover(this);
e.stopPropagation(); e.stopPropagation();

View File

@ -3,6 +3,6 @@
<span id="stream_sidebar_privacy_swatch_{{stream_id}}" class="stream-privacy filter-icon" style="color: {{stream_color}}"> <span id="stream_sidebar_privacy_swatch_{{stream_id}}" class="stream-privacy filter-icon" style="color: {{stream_color}}">
{{> stream_privacy }} {{> stream_privacy }}
</span> </span>
<a href="{{stream_edit_url}}">{{name}}</a> <a class = "stream_list_item" href="{{stream_edit_url}}">{{name}}</a>
</td> </td>
</tr> </tr>