Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ai-help): don't allow empty questions #10344

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Conversation

fiji-flo
Copy link
Contributor

Summary

Don't allow empty (or only white space) questions when editing a question and disable the submit button if empty / only white space.

@fiji-flo fiji-flo requested a review from a team as a code owner January 18, 2024 13:57
@github-actions github-actions bot added plus work around features related to MDN Plus plus:ai-help labels Jan 18, 2024
Copy link
Contributor

@argl argl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fiji-flo I think you need to update the onKeyDown handler of the ExpandingTextarea in line 170 as well:

onKeyDown={(event) => {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
if (canEdit && question) {
gleanClick(`${AI_HELP}: edit submit`);
setEditing(false);
submit(
question,
message.chatId,
message.parentId,
message.messageId
);
}
}
}}

@fiji-flo fiji-flo requested a review from caugner January 22, 2024 14:53
@fiji-flo fiji-flo merged commit 6cd6d4a into main Jan 24, 2024
15 checks passed
@fiji-flo fiji-flo deleted the MP-675-no-empty-question branch January 24, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plus:ai-help plus work around features related to MDN Plus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants