mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
popovers: Reorganize Tippy onShow logic for stream popover.
These changes appear to correct the keyboard-navigation repro from #25907, and it makes it possible for users without the permission to create streams to exit the streams modal by hitting Esc. This reorganizes logic within the Tippy `onShow` method to ensure that nothing is set or called for those users without stream-creation privileges. These changes probably require broader testing to determine whether the fix addresses only that specific reproducer, or the broader problems #25907 addresses with malfunctioning j, k, Esc, and Return keys (when Ctrl + Return to send is enabled). Fixes a part of #25907.
This commit is contained in:
committed by
Alex Vandiver
parent
5a177bff3a
commit
f5e2a2a38f
@@ -332,12 +332,10 @@ export function do_schedule_message(send_at_time) {
|
|||||||
export function initialize() {
|
export function initialize() {
|
||||||
register_popover_menu("#streams_inline_icon", {
|
register_popover_menu("#streams_inline_icon", {
|
||||||
onShow(instance) {
|
onShow(instance) {
|
||||||
popover_instances.stream_settings = instance;
|
|
||||||
const can_create_streams =
|
const can_create_streams =
|
||||||
settings_data.user_can_create_private_streams() ||
|
settings_data.user_can_create_private_streams() ||
|
||||||
settings_data.user_can_create_public_streams() ||
|
settings_data.user_can_create_public_streams() ||
|
||||||
settings_data.user_can_create_web_public_streams();
|
settings_data.user_can_create_web_public_streams();
|
||||||
on_show_prep(instance);
|
|
||||||
|
|
||||||
if (!can_create_streams) {
|
if (!can_create_streams) {
|
||||||
// If the user can't create streams, we directly
|
// If the user can't create streams, we directly
|
||||||
@@ -347,7 +345,12 @@ export function initialize() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assuming that the instance can be shown, track and
|
||||||
|
// prep the instance for showing
|
||||||
|
popover_instances.stream_settings = instance;
|
||||||
instance.setContent(parse_html(render_left_sidebar_stream_setting_popover()));
|
instance.setContent(parse_html(render_left_sidebar_stream_setting_popover()));
|
||||||
|
on_show_prep(instance);
|
||||||
|
|
||||||
// When showing the popover menu, we want the
|
// When showing the popover menu, we want the
|
||||||
// "Add streams" and the "Filter streams" tooltip
|
// "Add streams" and the "Filter streams" tooltip
|
||||||
// to appear below the "Add streams" icon.
|
// to appear below the "Add streams" icon.
|
||||||
@@ -361,6 +364,8 @@ export function initialize() {
|
|||||||
filter_streams_tooltip._tippy?.setProps({
|
filter_streams_tooltip._tippy?.setProps({
|
||||||
placement: "bottom",
|
placement: "bottom",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The linter complains about unbalanced returns
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onHidden(instance) {
|
onHidden(instance) {
|
||||||
|
|||||||
Reference in New Issue
Block a user