File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel/prompts/PromptField Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,7 +302,9 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
302302 raw_text : props . value ,
303303 context_file_paths : props . selected_files ?? [ ]
304304 } )
305- input_ref . current . focus ( )
305+ if ( ! props . warning ) {
306+ input_ref . current . focus ( )
307+ }
306308 set_caret_position_for_div ( input_ref . current , display_pos )
307309 } else if ( is_focused ) {
308310 set_caret_position_for_div ( input_ref . current , selection_start )
@@ -375,7 +377,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
375377 [ styles [ 'container__inner--selecting' ] ] : is_text_selecting
376378 } ) }
377379 onKeyDown = { handle_container_key_down }
378- onClick = { ( ) => input_ref . current ?. focus ( ) }
380+ onClick = { ( ) => ! props . warning && input_ref . current ?. focus ( ) }
379381 >
380382 < div className = { styles [ 'input-wrapper' ] } >
381383 { props . tabs_count > 1 ? (
@@ -496,7 +498,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
496498 < div
497499 className = { styles . footer }
498500 onClick = { ( ) => {
499- if ( input_ref . current ) {
501+ if ( input_ref . current && ! props . warning ) {
500502 input_ref . current . focus ( )
501503 const selection = window . getSelection ( )
502504 if ( selection ) {
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ export const use_handlers = (
157157 useEffect ( ( ) => {
158158 if ( params . input_ref . current && ! props_ref . current . warning ) {
159159 requestAnimationFrame ( ( ) => {
160- if ( ! params . input_ref . current ) return
160+ if ( ! params . input_ref . current || props_ref . current . warning ) return
161161 params . input_ref . current . focus ( { preventScroll : true } )
162162 } )
163163 }
@@ -166,7 +166,7 @@ export const use_handlers = (
166166 useEffect ( ( ) => {
167167 if ( params . input_ref . current && ! props_ref . current . warning ) {
168168 requestAnimationFrame ( ( ) => {
169- if ( ! params . input_ref . current ) return
169+ if ( ! params . input_ref . current || props_ref . current . warning ) return
170170 params . input_ref . current . focus ( { preventScroll : true } )
171171 const selection = window . getSelection ( )
172172 if ( selection ) {
You can’t perform that action at this time.
0 commit comments