fix: prevent integrations menu from closing when valves modal is open

When the "Valves" modal is opened from the "Integrations" menu, a click outside the modal would incorrectly close the integrations menu first. This was because the dropdown's outside click handler was still active.

This commit fixes the issue by introducing a `closeOnOutsideClick` prop to the `Dropdown` component. This prop is controlled by the `MessageInput` component, which now disables the outside click handler on the integrations menu when the valves modal is open, and re-enables it when the modal is closed.
This commit is contained in:
silentoplayz 2025-10-13 18:13:08 -04:00
parent a730a277b9
commit 4b160d88a2
3 changed files with 15 additions and 0 deletions

View File

@ -117,6 +117,11 @@
let showValvesModal = false;
let selectedValvesType = 'tool'; // 'tool' or 'function'
let selectedValvesItemId = null;
let integrationsMenuCloseOnOutsideClick = true;
$: if (!showValvesModal) {
integrationsMenuCloseOnOutsideClick = true;
}
$: onChange({
prompt,
@ -944,6 +949,9 @@
on:save={async () => {
await tick();
}}
on:close={() => {
integrationsMenuCloseOnOutsideClick = true;
}}
/>
{#if loaded}
@ -1463,11 +1471,13 @@
bind:webSearchEnabled
bind:imageGenerationEnabled
bind:codeInterpreterEnabled
closeOnOutsideClick={integrationsMenuCloseOnOutsideClick}
onShowValves={(e) => {
const { type, id } = e;
selectedValvesType = type;
selectedValvesItemId = id;
showValvesModal = true;
integrationsMenuCloseOnOutsideClick = false;
}}
onClose={async () => {
await tick();

View File

@ -42,6 +42,7 @@
export let onShowValves: Function;
export let onClose: Function;
export let closeOnOutsideClick = true;
let show = false;
let tab = '';
@ -93,6 +94,7 @@
<Dropdown
bind:show
{closeOnOutsideClick}
on:change={(e) => {
if (e.detail === false) {
onClose();

View File

@ -9,12 +9,15 @@
export let show = false;
export let side = 'bottom';
export let align = 'start';
export let closeOnOutsideClick = true;
const dispatch = createEventDispatcher();
</script>
<DropdownMenu.Root
bind:open={show}
closeFocus={false}
{closeOnOutsideClick}
onOpenChange={(state) => {
dispatch('change', state);
}}