diff --git a/docs/en_US/release_notes_9_14.rst b/docs/en_US/release_notes_9_14.rst index f841dcd5cd5..ba0e2a6339a 100644 --- a/docs/en_US/release_notes_9_14.rst +++ b/docs/en_US/release_notes_9_14.rst @@ -31,3 +31,4 @@ Bug fixes | `Issue #9279 `_ - Fixed an issue where OAuth2 authentication fails with 'object has no attribute' if OAUTH2_AUTO_CREATE_USER is False. | `Issue #9392 `_ - Ensure that the Geometry Viewer refreshes when re-running queries or switching geometry columns, preventing stale data from being displayed. | `Issue #9721 `_ - Fixed an issue where permissions page is not completely accessible on full scroll. + | `Issue #9740 `_ - Fixed an issue where the AI Assistant input textbox sometimes swallows the first character of input. diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/NLQChatPanel.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/NLQChatPanel.jsx index 5bbd2c413bd..669580dd535 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/NLQChatPanel.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/NLQChatPanel.jsx @@ -288,6 +288,7 @@ export function NLQChatPanel() { }); const messagesEndRef = useRef(null); + const inputRef = useRef(null); const abortControllerRef = useRef(null); const readerRef = useRef(null); const stoppedRef = useRef(false); @@ -366,6 +367,16 @@ export function NLQChatPanel() { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages]); + // Auto-focus the input when loading completes + useEffect(() => { + if (!isLoading) { + // Defer focus to ensure the DOM has updated (disabled=false) + setTimeout(() => { + inputRef.current?.focus(); + }, 0); + } + }, [isLoading]); + // Force CodeMirror re-render when panel becomes visible (fixes tab switching issue) const [cmKey, setCmKey] = useState(0); useEffect(() => { @@ -741,6 +752,7 @@ export function NLQChatPanel() {