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

[BUG] Selected Answer is not resetting after question check and navigation to next question if there is just one question in the module #250

Closed
Rllyyy opened this issue Mar 22, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Rllyyy
Copy link
Owner

Rllyyy commented Mar 22, 2023

No description provided.

@Rllyyy Rllyyy added the bug Something isn't working label Mar 22, 2023
@Rllyyy Rllyyy self-assigned this Mar 22, 2023
@Rllyyy
Copy link
Owner Author

Rllyyy commented Mar 22, 2023

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
    e.preventDefault();

    //If the correct answer isn't shown (before first form submit), check if the answer is correct by calling the check method on the questionAnswerRef
    //Else navigate to the next question (before second form submit)
    if (!showAnswer) {
      setAnswerCorrect(questionAnswerRef.current?.checkAnswer() || false);
      setShowAnswer(true);
    } else {
      questionDataRef.current?.scrollTo({ top: 0, behavior: "auto" });
      questionAnswerRef.current?.resetSelection(); //!updated part

      navigateToNextQuestion();
      setShowAnswer(false);
    }
  };

Edit: Choose a different option as this didn't fix instances where the user used the navigation buttons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant