diff --git a/packages/code-du-travail-frontend/src/search/SearchBar/DocumentSuggester.js b/packages/code-du-travail-frontend/src/search/SearchBar/DocumentSuggester.js index b157b50f7c..ffd13a6b74 100644 --- a/packages/code-du-travail-frontend/src/search/SearchBar/DocumentSuggester.js +++ b/packages/code-du-travail-frontend/src/search/SearchBar/DocumentSuggester.js @@ -117,8 +117,7 @@ const SuggestionContainer = styled.div` `; const renderSuggestion = (suggestion, query) => { - const regexp = new RegExp(query); - const title = suggestion.replace(regexp, "$&"); + const title = suggestion.replace(query, `${query}`); return ( {title} diff --git a/packages/code-du-travail-frontend/src/search/SearchBar/index.js b/packages/code-du-travail-frontend/src/search/SearchBar/index.js index b43d91bd59..197a74c5a2 100644 --- a/packages/code-du-travail-frontend/src/search/SearchBar/index.js +++ b/packages/code-du-travail-frontend/src/search/SearchBar/index.js @@ -34,7 +34,7 @@ const SearchBar = ({ router.push({ pathname: "/recherche", query: { - q: query + q: query.trim() } }); }