diff --git a/package-lock.json b/package-lock.json index dda4942..92d0012 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/chat-ui-react", - "version": "0.11.1", + "version": "0.11.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@yext/chat-ui-react", - "version": "0.11.1", + "version": "0.11.2", "license": "BSD-3-Clause", "dependencies": { "react-markdown": "^8.0.7", diff --git a/package.json b/package.json index fd4d9c3..21d850d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/chat-ui-react", - "version": "0.11.1", + "version": "0.11.2", "description": "A library of React Components for powering Yext Chat integrations.", "author": "clippy@yext.com", "main": "./lib/commonjs/src/index.js", diff --git a/src/components/ChatInput.tsx b/src/components/ChatInput.tsx index 26bae4f..a6b0919 100644 --- a/src/components/ChatInput.tsx +++ b/src/components/ChatInput.tsx @@ -80,7 +80,7 @@ export interface ChatInputProps { export function ChatInput({ placeholder = "Type a message...", stream = false, - inputAutoFocus = false, + inputAutoFocus = true, handleError, sendButtonIcon = , customCssClasses, diff --git a/tests/components/ChatInput.test.tsx b/tests/components/ChatInput.test.tsx index cc88f0c..8c7b461 100644 --- a/tests/components/ChatInput.test.tsx +++ b/tests/components/ChatInput.test.tsx @@ -35,16 +35,16 @@ it("updates text when type in textarea", async () => { expect(textbox).toHaveDisplayValue("test"); }); -it("does not focus on input box by default", async () => { +it("maintains focus on input box by default", async () => { render(); const textbox = screen.getByRole("textbox"); - expect(textbox).not.toHaveFocus(); + expect(textbox).toHaveFocus(); }); -it("maintains focus on input box when inputAutoFocus field is set to true", async () => { - render(); +it("does not focus on input box when inputAutoFocus field is set to false", async () => { + render(); const textbox = screen.getByRole("textbox"); - expect(textbox).toHaveFocus(); + expect(textbox).not.toHaveFocus(); }); it("sends request and reset input when click on send button", async () => {