Merge pull request #1427 from Monilprajapati/2.0.0

Fixed page reload issue on EnterKey press
This commit is contained in:
Frikky
2024-06-17 11:05:35 +02:00
committed by GitHub
6 changed files with 32 additions and 2 deletions
+10
View File
@@ -232,6 +232,11 @@ const AppGrid = (props) => {
removeQuery("q"); removeQuery("q");
refine(event.currentTarget.value); refine(event.currentTarget.value);
}} }}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
limit={5} limit={5}
/> />
{/*isSearchStalled ? 'My search is stalled' : ''*/} {/*isSearchStalled ? 'My search is stalled' : ''*/}
@@ -994,6 +999,11 @@ const AppGrid = (props) => {
onChange={(event) => { onChange={(event) => {
setSearchQuery(event.currentTarget.value); setSearchQuery(event.currentTarget.value);
}} }}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
limit={5} limit={5}
/> />
{/*isSearchStalled ? 'My search is stalled' : ''*/} {/*isSearchStalled ? 'My search is stalled' : ''*/}
+5
View File
@@ -136,6 +136,11 @@ const CreatorGrid = props => {
removeQuery("q") removeQuery("q")
refine(event.currentTarget.value) refine(event.currentTarget.value)
}} }}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
/> />
{/*isSearchStalled ? 'My search is stalled' : ''*/} {/*isSearchStalled ? 'My search is stalled' : ''*/}
</form> </form>
+5
View File
@@ -75,6 +75,11 @@ const DiscordChat = props => {
fullWidth fullWidth
value={currentRefinement} value={currentRefinement}
onChange={(event) => refine(event.currentTarget.value)} onChange={(event) => refine(event.currentTarget.value)}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
placeholder="Search Discord Chats" placeholder="Search Discord Chats"
style={{ backgroundColor: theme.palette.inputColor, borderRadius: borderRadius, margin: 10, width: "100%", }} style={{ backgroundColor: theme.palette.inputColor, borderRadius: borderRadius, margin: 10, width: "100%", }}
InputProps={{ InputProps={{
+5
View File
@@ -124,6 +124,11 @@ const DocsGrid = props => {
removeQuery("q") removeQuery("q")
refine(event.currentTarget.value) refine(event.currentTarget.value)
}} }}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
limit={5} limit={5}
/> />
{/*isSearchStalled ? 'My search is stalled' : ''*/} {/*isSearchStalled ? 'My search is stalled' : ''*/}
+2 -2
View File
@@ -88,12 +88,12 @@ const SearchData = props => {
const textFieldRef = useRef(null); const textFieldRef = useRef(null);
const keyPressHandler = (e) => { const keyPressHandler = (e) => {
if (e.which === 13) { if (e.key === "Enter") {
e.preventDefault();
// navigate(`/search?q=${currentRefinement}`, { state: value, replace: true }); // navigate(`/search?q=${currentRefinement}`, { state: value, replace: true });
// setModalOpen(false); // setModalOpen(false);
const trimmedValue = inputValue.trim(); const trimmedValue = inputValue.trim();
if (trimmedValue !== '') { if (trimmedValue !== '') {
e.preventDefault();
navigate(`/search?q=${trimmedValue}`, { state: trimmedValue, replace: true }); navigate(`/search?q=${trimmedValue}`, { state: trimmedValue, replace: true });
setModalOpen(false); setModalOpen(false);
} }
+5
View File
@@ -221,6 +221,11 @@ const AppGrid = props => {
removeQuery("q") removeQuery("q")
refine(event.currentTarget.value) refine(event.currentTarget.value)
}} }}
onKeyDown={(event) => {
if(event.key === "Enter") {
event.preventDefault();
}
}}
limit={5} limit={5}
/> />
: null} : null}