bbc / simorgh

The BBC's Open Source Web Application. Contributions welcome! Used on some of our biggest websites, e.g.
https://www.bbc.com/thai
Other
1.28k stars 211 forks source link

WSTEAM1-1028 Add (optional) to Label for non-required fields #11711

Closed emilysaffron closed 1 month ago

emilysaffron commented 1 month ago

Resolves JIRA WSTEAM1-1028

Overall changes

Hard codes "(optional)" to the end of a form field's label if it's not required - translations to come in future work.

Code changes

Testing

  1. Visit http://localhost.bbc.com:7081/mundo/send/u50853489?renderer_env=live and http://localhost.bbc.com:7081/somali/send/u130092370?renderer_env=test or the storybook permalink and see the optional text. Note that the "Attach your file" label in the second link has two (optional)s because the first one has been sent through from the api - this will need to be changed in future via editorial.

a11y (criteria on the ticket) :

Mobile

Desktop

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

amoore108 commented 1 month ago

Should maybe add a Test and snapshot to render a field that is required to check the conditional rendering logic of the 'optional' text.