:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(phai): submit composer on Enter (#67420)
Georgiy Tarasovfe25384cb78f
diff --git a/products/posthog_ai/frontend/components/RunComposer.tsx b/products/posthog_ai/frontend/components/RunComposer.tsxindex f199e881e374..b33466a13591 100644--- a/products/posthog_ai/frontend/components/RunComposer.tsx+++ b/products/posthog_ai/frontend/components/RunComposer.tsx@@ -43,11 +43,7 @@ export function RunComposer({<Composer.Frame><Composer.Field><Composer.Placeholder>{placeholder}</Composer.Placeholder>- <Composer.Textarea- data-attr="sandbox-composer-input"- submitShortcut="cmd-enter"- autoFocus={autoFocus}- />+ <Composer.Textarea data-attr="sandbox-composer-input" autoFocus={autoFocus} /></Composer.Field></Composer.Frame><Composer.Submit data-attr="sandbox-composer-send" />diff --git a/products/posthog_ai/frontend/components/composer/Composer.stories.tsx b/products/posthog_ai/frontend/components/composer/Composer.stories.tsxindex 1e9f66080091..e9e0f59e69d9 100644--- a/products/posthog_ai/frontend/components/composer/Composer.stories.tsx+++ b/products/posthog_ai/frontend/components/composer/Composer.stories.tsx@@ -17,7 +17,6 @@ interface ComposerStoryArgs {disabledReason?: stringisSticky: booleanisThreadVisible: boolean- submitShortcut: 'enter' | 'cmd-enter'}type Story = StoryObj<ComposerStoryArgs>@@ -33,12 +32,8 @@ const meta: Meta<ComposerStoryArgs> = {disabledReason: undefined,isSticky: false,isThreadVisible: false,- submitShortcut: 'enter',},- argTypes: {- submitShortcut: { control: 'radio', options: ['enter', 'cmd-enter'] },- },- render: ({ initialValue, placeholder, submitShortcut, ...rootProps }) => {+ render: ({ initialValue, placeholder, ...rootProps }) => {const [value, setValue] = useState(initialValue)return (<div className="max-w-180 mx-auto p-4">@@ -46,7 +41,7 @@ const meta: Meta<ComposerStoryArgs> = {<Composer.Frame><Composer.Field><Composer.Placeholder>{placeholder}</Composer.Placeholder>- <Composer.Textarea submitShortcut={submitShortcut} />+ <Composer.Textarea /></Composer.Field></Composer.Frame><Composer.Submit />@@ -79,7 +74,7 @@ export const Disabled: Story = {/** Follow-up variant: tighter frame radius/border and a nudged send button (`isThreadVisible`). */export const FollowUp: Story = {- args: { initialValue: 'One more thing…', isThreadVisible: true, submitShortcut: 'cmd-enter' },+ args: { initialValue: 'One more thing…', isThreadVisible: true },}/** Page-level sticky chrome: bordered, blurred, bottom-pinned container around the frame. */@@ -96,7 +91,7 @@ export const Sticky: Story = {/** With a footer row for context chips / actions inside the frame. */export const WithFooter: Story = {- render: ({ initialValue, placeholder, submitShortcut, ...rootProps }) => {+ render: ({ initialValue, placeholder, ...rootProps }) => {const [value, setValue] = useState(initialValue)return (<div className="max-w-180 mx-auto p-4">@@ -104,7 +99,7 @@ export const WithFooter: Story = {<Composer.Frame><Composer.Field><Composer.Placeholder>{placeholder}</Composer.Placeholder>- <Composer.Textarea submitShortcut={submitShortcut} />+ <Composer.Textarea /></Composer.Field><Composer.Footer><div className="flex items-center gap-1 pl-2">@@ -122,8 +117,8 @@ export const WithFooter: Story = {/** Editable "Up next" queue rendered in the Banner slot above the frame (the tasks follow-up surface). */export const WithUpNextQueue: Story = {- args: { isThreadVisible: true, submitShortcut: 'cmd-enter' },- render: ({ initialValue, placeholder, submitShortcut, ...rootProps }) => {+ args: { isThreadVisible: true },+ render: ({ initialValue, placeholder, ...rootProps }) => {const [value, setValue] = useState(initialValue)const [queue, setQueue] = useState([{ id: '1', content: 'Also break it down by browser' },@@ -144,7 +139,7 @@ export const WithUpNextQueue: Story = {<Composer.Frame><Composer.Field><Composer.Placeholder>{placeholder}</Composer.Placeholder>- <Composer.Textarea submitShortcut={submitShortcut} />+ <Composer.Textarea /></Composer.Field></Composer.Frame><Composer.Submit />diff --git a/products/posthog_ai/frontend/components/composer/Composer.tsx b/products/posthog_ai/frontend/components/composer/Composer.tsxindex b0d1f0f8f85a..f4548a2ff20c 100644--- a/products/posthog_ai/frontend/components/composer/Composer.tsx+++ b/products/posthog_ai/frontend/components/composer/Composer.tsx@@ -277,24 +277,18 @@ export interface ComposerTextareaProps {autoFocus?: booleanminRows?: numbermaxRows?: number- /** `'enter'` submits on Enter (PostHog AI), `'cmd-enter'` on Cmd/Ctrl+Enter (tasks composer). */- submitShortcut?: 'enter' | 'cmd-enter''data-attr'?: string}-/** The textarea itself, wired to the context value/submit. */+/** The textarea itself, wired to the context value/submit. Submits on Enter, Shift+Enter for a newline. */function ComposerTextarea({className,autoFocus,minRows = 1,maxRows = 10,- submitShortcut = 'enter',...rest}: ComposerTextareaProps): JSX.Element {const { value, onChange, submit, textAreaRef, disabled, id } = useComposerContext()- // onPressEnter / onPressCmdEnter are mutually exclusive in LemonTextArea's type — pick one.- const submitProps =- submitShortcut === 'cmd-enter' ? { onPressCmdEnter: () => submit() } : { onPressEnter: () => submit() }return (<LemonTextAreaid={id}@@ -308,7 +302,7 @@ function ComposerTextarea({autoFocus={autoFocus}className={cn('!border-none !bg-transparent min-h-16 py-2 pl-2 pr-12 resize-none', className)}hideFocus- {...submitProps}+ onPressEnter={() => submit()}{...rest}/>)diff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskComposer.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskComposer.tsxindex 8211baf5fbee..7ad8e671ecb2 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskComposer.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskComposer.tsx@@ -58,11 +58,7 @@ export function TaskComposer(): JSX.Element {<Composer.Frame><Composer.Field><Composer.Placeholder>Describe the task in detail…</Composer.Placeholder>- <Composer.Textarea- submitShortcut="cmd-enter"- autoFocus- data-attr="task-composer-input"- />+ <Composer.Textarea autoFocus data-attr="task-composer-input" /></Composer.Field><Composer.Footer><ComposerModelEffortPickersdiff --git a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsxindex ca3809779291..b6f4a1c55ede 100644--- a/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx+++ b/products/posthog_ai/frontend/scenes/TaskTracker/components/TaskRunChat.tsx@@ -106,7 +106,7 @@ function TaskRunChatContent({ logicProps }: { logicProps: RunInteractionLogicPro<Composer.Placeholder>{isTerminal ? 'Send a message to start a new run…' : 'Send a follow-up message…'}</Composer.Placeholder>- <Composer.Textarea data-attr="sandbox-composer-input" submitShortcut="cmd-enter" />+ <Composer.Textarea data-attr="sandbox-composer-input" /></Composer.Field><Composer.Footer>{/* Model/effort picker: selection lives in the bound runInteractionLogic and is