department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
282 stars 202 forks source link

508-defect-4 - Consider refactoring the FormSignature to include heading and attestation statement #26273

Closed 1Copenut closed 4 weeks ago

1Copenut commented 3 years ago

508-defect-4

Feedback framework

Definition of done

  1. Review and acknowledge feedback.
  2. Fix and/or document decisions made.
  3. Accessibility specialist will close ticket after reviewing documented decisions / validating fix.

Point of Contact

VFS Point of Contact: Trevor

Details

I'd like to discuss refactoring this component to include the [Veteran] statement of truth heading and paragraph(s) in a self-contained element. I spent a lot of time looking at the Zeplin prototypes and feel we could improve accessibility here by rolling those in, and adding an aria-describedby attribute to the heading. This will help surface that information to screen readers.

Acceptance Criteria

Proposed Solution (if known)

export const FormSignature = ({
  signatureLabel,
  checkboxLabel,
  formData,
+ level
  setFormData,
  signatureHeading,
+ statementDetail,
+ statementHeader,
  required,
  showError,
  validations,
  onSectionComplete,
}) => {
  // Component hooks ...

+ const H = `h${this.props.level}`;

  return (
    <div className="box vads-u-background-color--gray-lightest vads-u-padding-bottom--6 vads-u-padding-x--3 vads-u-padding-top--1px vads-u-margin-bottom--7">
+     <H>{statementHeader}</H>
+     <div id="statement-unique-id">{statementDetail}</div>
      <TextInput
        label={signatureLabel}
        field={signature}
        onValueChange={setSignature}
        required={required}
        errorMessage={(showError || signature.dirty) && signatureError}
      />
      <Checkbox
+       aria-labelledby="statement-unique-id"
        label={checkboxLabel}
        required={required}
        onValueChange={setChecked}
        errorMessage={showError && checkboxError}
      />
    </div>
  );
}

FormSignature.defaultProps = {
+ level: 2
}

FormSignature.propTypes = {
+ level: PropTypes.number
+ statementHeader: PropTypes.string.isRequired,
+ statementDetail: PropTypes.oneOfType([
+   PropTypes.string,
+   PropTypes.node
  ]).isRequired
}
caw310 commented 2 years ago

Need to retest.

caw310 commented 4 weeks ago

@rsmithadhoc Would you see if this is still an issue?

rsmithadhoc commented 4 weeks ago

@caw310 I don't believe so. This references an old React component, and our Statement of Truth web component contains the heading and description. I will go ahead and close this one.