@@ -353,6 +353,10 @@ export default {
353353 type: Object as PropType <unknown >,
354354 required: false ,
355355 },
356+ disableAutoFocusOnActivate: {
357+ type: Boolean ,
358+ default: false ,
359+ },
356360 },
357361 data() {
358362 return {
@@ -604,23 +608,25 @@ export default {
604608 }
605609
606610 // When activating a tab, always jump to the bottom so the latest
607- // messages are immediately visible.
611+ // messages are immediately visible, and optionally focus the input .
608612 if (active && ! this .isMinimized ) {
609613 this .safeScrollToBottom (true );
610- this .$nextTick (() => {
611- const chatInput = this .$refs .chatInputRef as any ;
612- if (chatInput ) {
613- if (typeof chatInput .focus === " function" ) {
614- chatInput .focus ();
615- } else if (chatInput .$el ) {
616- // Fallback: try to focus the first input inside the component root.
617- const el = chatInput .$el .querySelector (
618- " input, textarea, [tabindex]" ,
619- ) as HTMLElement | null ;
620- el ?.focus ();
614+ if (! this .disableAutoFocusOnActivate ) {
615+ this .$nextTick (() => {
616+ const chatInput = this .$refs .chatInputRef as any ;
617+ if (chatInput ) {
618+ if (typeof chatInput .focus === " function" ) {
619+ chatInput .focus ();
620+ } else if (chatInput .$el ) {
621+ // Fallback: try to focus the first input inside the component root.
622+ const el = chatInput .$el .querySelector (
623+ " input, textarea, [tabindex]" ,
624+ ) as HTMLElement | null ;
625+ el ?.focus ();
626+ }
621627 }
622- }
623- });
628+ });
629+ }
624630 }
625631 },
626632 },
0 commit comments