Skip to content

Commit

Permalink
Retain focus in search field for custom search
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Nov 19, 2024
1 parent fda3b26 commit 3cc62cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Entities.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export const Entities = ({
const navigate = useNavigate();

useEffect(() => {
if (displaySearch && searchRef && searchRef.current) {
if ((displaySearch || searchAutoFocus) && searchRef && searchRef.current) {
searchRef.current.focus();
}
}, [displaySearch])
}, [displaySearch, searchAutoFocus])

const newEntity = () => {
if (newEntityFunc) {
Expand Down
1 change: 1 addition & 0 deletions client/src/tabs/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export const Users = () => {
inputFocus={true}
customSearch={search}
rowLinkMapper={openUser}
searchAutoFocus={!searching}
busy={searching}>
{initial && <div className={"image-container"}>
<img src={SearchSvg} alt="search"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class FullSearchQueryParserTest {
void parse() {
String parsed = FullSearchQueryParser.parse("This *is+ +a ** test for + the [email protected] *query*");
assertEquals("+test +john +doe +example +query*", parsed);

String emailParsed = FullSearchQueryParser.parse("[email protected]");
assertEquals("+brand +ms +play*", emailParsed);
}

@Test
Expand Down

0 comments on commit 3cc62cc

Please sign in to comment.