Fix focus behaviour when opening single-purpose features (#2349)
authorGimle Larpes <97182804+GimleLarpes@users.noreply.github.com>
Sat, 28 Jun 2025 14:45:21 +0000 (16:45 +0200)
committerGitHub <noreply@github.com>
Sat, 28 Jun 2025 14:45:21 +0000 (20:15 +0530)
* Improve focus behaviour on search boxes and chats

* Implemented MR #2317

* Fix crash if canMessage is false

* Prepare for PR #2335

* disable autofocus on message field

src/app/features/message-search/SearchInput.tsx
src/app/organisms/invite-user/InviteUser.jsx

index db646c2630bad62d89eb03f34cfaacdbd5429b34..533eb5fdbb2d601e87abfdb7e738c852cbfd6518 100644 (file)
@@ -29,6 +29,7 @@ export function SearchInput({ active, loading, searchInputRef, onSearch, onReset
         ref={searchInputRef}
         style={{ paddingRight: config.space.S300 }}
         name="searchInput"
+        autoFocus
         size="500"
         variant="Background"
         placeholder="Search for keyword"
index c5bade690fd6c12dd44d433ecd6d97ed6a05f8a5..271c22a961736f909bc32a3b2452c87164a08f90 100644 (file)
@@ -273,7 +273,7 @@ function InviteUser({ isOpen, roomId, searchTerm, onRequestClose }) {
             searchUser(usernameRef.current.value);
           }}
         >
-          <Input value={searchTerm} forwardRef={usernameRef} label="Name or userId" />
+          <Input value={searchTerm} forwardRef={usernameRef} label="Name or userId" autoFocus />
           <Button disabled={isSearching} iconSrc={UserIC} variant="primary" type="submit">
             Search
           </Button>