Skip to content

Commit d70dda0

Browse files
Merge pull request #541 from microsoft/PSL-Bug-17658
fix: Home screen input box does not trigger any action or navigation upon submitting a question
2 parents 205291a + cf66df1 commit d70dda0

File tree

1 file changed

+12
-0
lines changed
  • src/frontend/src/components/Homepage

1 file changed

+12
-0
lines changed

src/frontend/src/components/Homepage/Cards.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ export const FeatureCard = (props: Props) => {
9797
export const TextFieldCard = ({ className, ...props }: CardProps) => {
9898
const appStateContext = React.useContext(AppStateContext);
9999

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+
100111
return (
101112
<Card
102113
{...props}
@@ -150,6 +161,7 @@ export const TextFieldCard = ({ className, ...props }: CardProps) => {
150161
flex: 1,
151162
width: "100%",
152163
}}
164+
onKeyDown={handleKeyDown}
153165
/>
154166
</Stack>
155167

0 commit comments

Comments
 (0)