Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Story/character limit #56

Merged
merged 14 commits into from
Aug 6, 2021
Merged

Story/character limit #56

merged 14 commits into from
Aug 6, 2021

Conversation

ksiegel1923
Copy link
Collaborator

No description provided.

@github-actions
Copy link

github-actions bot commented Aug 5, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Aug 5, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

@michellexliu michellexliu linked an issue Aug 5, 2021 that may be closed by this pull request
@ksiegel1923 ksiegel1923 reopened this Aug 5, 2021
@github-actions
Copy link

github-actions bot commented Aug 5, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

if user has other too long error and then unchecks other the error will go away
all errors will appear to the user rather than just the first one
@github-actions
Copy link

github-actions bot commented Aug 6, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

question.type === "textarea" &&
question.answer.length > TEXTAREA_MAX_CHAR
) {
(validated = false), (question.charError = true);
Copy link
Collaborator

@michellexliu michellexliu Aug 6, 2021

Choose a reason for hiding this comment

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

Is there a reason we need this to be charError instead of just error? Also, I noticed that there are a lot of repeated checks going on between this inputsValidated function and the inputError function in TextboxList (for example, we check question.type here and input.type in TextboxList.js.) I feel like it would make things simpler if instead of question.error being a boolean, we set question.error to be the actual error message key or undefined if there is none. Then, instead of doing all these checks again in the inputError function and separating out error and charError, we could just do a simple

if (inputQuestions && inputQuestions[index] && inputQuestions[index].error) {
const key = inputQuestions[index].error;
return (
      <ErrorAlert
        key={key}
        errorText={t(`errorMessages.${key}`)}
        id={id}
        className="margin-bottom-2"
      />
    );
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, probably not a big deal, but the validated variable seems a little unnecessary to me and seems kind of redundant to have to set it in each if/else if body. I think it might be cleaner if we just return

return !inputQuestions.some(question => question.error);

at the very end

@github-actions
Copy link

github-actions bot commented Aug 6, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

@github-actions
Copy link

github-actions bot commented Aug 6, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

} else if (!otherFieldValidated()) {
setOtherTooLong(true);
}
if (screen.textInputs && !inputsValidated()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason this is an if instead of an else if? If there is a missing checkbox and an improper input at the same time, the focus should go to the checkbox since it comes before, but right now it goes to the input instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If this is an else if then it will only show the checkbox error even if there are two errors

Copy link
Collaborator

@michellexliu michellexliu Aug 6, 2021

Choose a reason for hiding this comment

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

I see— should we add an extra check for the checkboxError then, so that we're not accidentally focusing on the input instead of the checkbox? So if (screen.textInputs && !inputsValidated() && !checkboxError)

@github-actions
Copy link

github-actions bot commented Aug 6, 2021

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-moss-01b532c0f-56.eastus2.azurestaticapps.net

@michellexliu michellexliu merged commit 9c80042 into dev Aug 6, 2021
@michellexliu michellexliu deleted the story/character-limit branch August 6, 2021 16:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Other field character limit still shows when unchecked
2 participants