fix(editor): Prevent chat window jump when hovering prompt suggestions (no-changelog) (#28683)

This commit is contained in:
Raúl Gómez Morales
2026-04-20 12:19:13 +00:00
committed by GitHub
parent db1eb91940
commit c17f5b61fe
4 changed files with 31 additions and 16 deletions
@@ -116,7 +116,7 @@ watch(
},
);
const showCreditBanner = computed(() => store.isLowCredits && !creditBannerDismissed.value);
const showEmptyStateLayout = computed(() => !store.hasMessages && !store.isHydratingThread);
const showEmptyStateLayout = computed(() => !props.threadId);
// Load persisted threads from Mastra storage on mount
onMounted(() => {
@@ -746,9 +746,9 @@ function handleStop() {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: var(--spacing--lg);
padding: var(--spacing--lg);
padding-top: 20vh;
}
.centeredInput {
@@ -107,14 +107,14 @@ describe('InstanceAiView', () => {
},
] as typeof store.messages;
const { getByTestId } = renderView();
const { getByTestId } = renderView({ props: { threadId: 'thread-1' } });
expect(getByTestId('instance-ai-input-stub')).toHaveTextContent('unset');
});
it('does not pass suggestions while an existing thread is hydrating', () => {
store.isHydratingThread = true;
const { getByTestId } = renderView();
const { getByTestId } = renderView({ props: { threadId: 'thread-1' } });
expect(getByTestId('instance-ai-input-stub')).toHaveTextContent('unset');
});
@@ -173,6 +173,13 @@ function handleSuggestionSubmit(payload: {
});
submitComposerMessage(i18n.baseText(payload.promptKey));
}
const resizable = computed(() => {
if (previewPromptKey.value) {
return { minRows: 2, maxRows: 2 };
}
return undefined;
});
</script>
<template>
@@ -183,6 +190,7 @@ function handleSuggestionSubmit(payload: {
:placeholder="placeholder"
:is-streaming="props.isStreaming"
:can-submit="canSubmit"
:autosize="resizable"
show-voice
show-attach
@submit="handleSubmit"
@@ -4,16 +4,24 @@ import { N8nIconButton, N8nInput, N8nTooltip } from '@n8n/design-system';
import { useI18n } from '@n8n/i18n';
import { useSpeechRecognition } from '@vueuse/core';
const props = defineProps<{
modelValue: string;
placeholder?: string;
isStreaming: boolean;
canSubmit: boolean;
disabled?: boolean;
showVoice?: boolean;
showAttach?: boolean;
acceptedMimeTypes?: string;
}>();
const props = withDefaults(
defineProps<{
modelValue: string;
placeholder?: string;
isStreaming: boolean;
canSubmit: boolean;
disabled?: boolean;
showVoice?: boolean;
showAttach?: boolean;
acceptedMimeTypes?: string;
autosize?: boolean | { minRows: number; maxRows: number };
}>(),
{
placeholder: undefined,
acceptedMimeTypes: undefined,
autosize: () => ({ minRows: 2, maxRows: 6 }),
},
);
const emit = defineEmits<{
'update:modelValue': [value: string];
@@ -122,14 +130,13 @@ defineExpose({
/>
<slot name="attachments" />
<N8nInput
ref="inputRef"
:model-value="modelValue"
type="textarea"
:placeholder="placeholder"
autocomplete="off"
:autosize="{ minRows: 1, maxRows: 6 }"
:autosize="autosize"
:disabled="disabled"
@update:model-value="emit('update:modelValue', $event)"
@keydown="handleKeydown"