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

[74] Enter Evaluators A11y Fix #343

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open

Conversation

emmabjj
Copy link
Contributor

@emmabjj emmabjj commented Jan 3, 2025

Related ticket: #200 #74
Figma

Changes made in this PR:

  • Given an existing user who was created without a first and last name,
    when adding that user as an evaluator to a challenge phase,
    then require and update the user with the provided first and last name.
  • Update the UI to use a single field for the first & last name instead of two separate form fields.
  • Update the UI to remove the subtitle below the form fields.
  • Add inline error messages and use usa-alert for form validation.
  • Update the challenge phase title.
  • Make alt text for "Add Evaluator" decorative

Updated UI

Screenshot 2025-01-03 at 1 01 29 PM

Validation errors

Empty form

Screenshot 2025-01-03 at 1 10 52 PM

Only a first name

Screenshot 2025-01-03 at 11 08 35 AM

Missing last name

Screenshot 2025-01-03 at 11 08 46 AM

User with invalid role

Screenshot 2025-01-03 at 11 07 05 AM

Required first and last name for existing user

Screenshot 2025-01-03 at 11 43 49 AM

Existing user without first and last name updated with name entered

Screenshot 2025-01-03 at 11 46 45 AM

Mobile

Screenshot 2025-01-03 at 1 11 18 PM

WAVE

Screenshot 2025-01-03 at 1 13 13 PM

@emmabjj emmabjj self-assigned this Jan 3, 2025
@emmabjj emmabjj requested a review from stepchud January 3, 2025 19:14
@r-bartlett-gsa r-bartlett-gsa added this to the Sprint 01/14/25 milestone Jan 3, 2025
@r-bartlett-gsa r-bartlett-gsa linked an issue Jan 3, 2025 that may be closed by this pull request
67 tasks
<p>Create and manage a list of evaluators for the challenge.</p>
<h2 class="padding-top-3">Add Evaluators</h2>
<p>Evaluators will not be assigned to submissions until you assign in the submission detail view.</p>
<%= form_with(model: EvaluatorInvitation.new, url: phase_evaluators_path(@phase), method: :post, local: true) do |form| %>
<%= form_with(model: @evaluator_invitation || EvaluatorInvitation.new, url: phase_evaluators_path(@phase), method: :post, local: true, data: { controller: "evaluator-form modal" }, html: { novalidate: true }) do |form| %>
Copy link
Contributor

Choose a reason for hiding this comment

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

the evaluator-form stimulus controller doesn't exist, did you mean to use evaluation-form controller?

Copy link
Contributor

Choose a reason for hiding this comment

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

since you're using the evaluation-form#validatePresence function here, I think it would be good to extract that functionality into a separate controller to be used in both places. the rest of the EvaluationFormController related to the EvaluationForm fields can stay there. that way we'll have a reusable form validation controller for other stimulus forms.

@emmabjj emmabjj requested a review from stepchud January 8, 2025 19:06
Copy link
Contributor

@stepchud stepchud left a comment

Choose a reason for hiding this comment

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

The missing inline error message is probably a blocker given the requirements. Plus some other suggestions to improve the design.

end

handle_failed_invitation(result)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm seeing some inconsistency with the error message display depending on the path it takes. Can we try to ensure that if there are any validation issues with the name(s) missing, that the First & Last Name label is always highlighted in red (as it does for new users)?

existing user
Screenshot 2025-01-09 at 3 05 15 PM

new user
Screenshot 2025-01-09 at 3 05 38 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

The first screenshot is also missing the inline error text label describing the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is also a case where only the first name is entered, First & Last Name label should be red:
Screenshot 2025-01-09 at 2 53 49 PM

@@ -44,6 +45,24 @@ def resend_invitation(invitation)

private

def update_name_for_existing_user(user)
names = @invitation_params[:full_name].to_s.strip.split(/\s+/, 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like it's potentially problematic to duplicate this field parsing logic with the EvaluatorInvitation model, in case things change in the future. Can you extract these into a single function? Something like User.split_full_name(full_name) => [first, last]

For the validation error message, you can just have a method that adds those errors directly to the model if first_name or last_name are blank. Actually it might be even easier to build a fake EvaluatorInvitation model first (without saving), check if it's valid, and if so then update the user. If it's invalid you can return the invalid Invitation with its errors. That way you're reusing the Invitation name splitting logic and you can get the invitation's first_name/last_name to update the User when the name is valid. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enter Evaluators
3 participants