dropdown_widget: Fix bug in disable_for_spectators

If `disable_for_spectators` is true, the widget text is greyed out
but the tippy instance is still delegated, causing it to appear
on click/enter.

This commit fixes that by not delegating tippy if the
`disable_for_spectators` is true.

This bug was surfaced when it was found that the
topic type filter in Recent conversations has disabled
styling for spectators, but a spectator could still click on it to
open the dropdown.

Fixes #30461
This commit is contained in:
Kislay Verma
2024-06-18 15:59:03 +05:30
committed by Tim Abbott
parent 43eebbf9c6
commit d38d82edc3

View File

@@ -179,6 +179,11 @@ export class DropdownWidget {
);
return;
}
if (this.disable_for_spectators && page_params.is_spectator) {
return;
}
this.instance = tippy.delegate(delegate_container, {
...popover_menus.default_popover_props,
target: this.widget_selector,