File tree 1 file changed +12
-0
lines changed
src/frontend/src/components/Homepage
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,17 @@ export const FeatureCard = (props: Props) => {
97
97
export const TextFieldCard = ( { className, ...props } : CardProps ) => {
98
98
const appStateContext = React . useContext ( AppStateContext ) ;
99
99
100
+ const handleKeyDown = ( event : React . KeyboardEvent < HTMLInputElement | HTMLTextAreaElement > ) => {
101
+ if ( event . key === 'Enter' ) {
102
+ if ( appStateContext ?. state . researchTopic ?. trim ( ) ) {
103
+ appStateContext . dispatch ( {
104
+ type : 'UPDATE_SIDEBAR_SELECTION' ,
105
+ payload : SidebarOptions . Article ,
106
+ } ) ;
107
+ }
108
+ }
109
+ } ;
110
+
100
111
return (
101
112
< Card
102
113
{ ...props }
@@ -150,6 +161,7 @@ export const TextFieldCard = ({ className, ...props }: CardProps) => {
150
161
flex : 1 ,
151
162
width : "100%" ,
152
163
} }
164
+ onKeyDown = { handleKeyDown }
153
165
/>
154
166
</ Stack >
155
167
You can’t perform that action at this time.
0 commit comments