GCTC-NTGC / gc-digital-talent

GC Digital Talent is the new recruitment platform for digital and tech jobs in the Government of Canada. // Talents numériques du GC est la nouvelle plateforme de recrutement pour les emplois numériques et technologiques au gouvernement du Canada.
https://talent.canada.ca
GNU Affero General Public License v3.0
22 stars 9 forks source link

Bring back accessible "required" form validation message #3679

Closed patcon closed 1 year ago

patcon commented 2 years ago

ℹ️ Figma (root) | Sitemap This initial comment is collaborative and open to modification by all.

Related: https://github.com/GCTC-NTGC/gc-digital-talent/pull/3630 https://github.com/GCTC-NTGC/gc-digital-talent/issues/3588

Removed {fieldLabel} from defaulted field error message (causing issues with react-intl and failing tests)

Description

First off, deep apologies for not seeing the problem with adding a token to the default required message https://github.com/GCTC-NTGC/gc-digital-talent/pull/3536. I think the green CI tests made my brain turn off :/ Thanks to Eric for reverting 🙏

Anyhow, since the purpose was a11y, prob worth fixing. The intention of the var in the string was so that the default message would include reference to the field, and screen-readers would be giving more context when they interrupt with feedback.

Proposed steps:

Acceptance Criteria

patcon commented 1 year ago

Alternative approach of simple wrapping useForm in a custom useForm (useFormCustom?) that adds the default messages: https://github.com/react-hook-form/react-hook-form/issues/458#issuecomment-1265907115

esizer commented 1 year ago

Closing in favour of #5416 since it has suggestions about the messages that should be presented.