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

Form with error not showing selected conditional content #608

Closed
nunommc opened this issue May 19, 2020 · 8 comments
Closed

Form with error not showing selected conditional content #608

nunommc opened this issue May 19, 2020 · 8 comments

Comments

@nunommc
Copy link

nunommc commented May 19, 2020

Bug Report

What is the issue?

Please watch this video for details.

When a form is submitted
And the validations are not fulfilled
The form is re-rendered with errors

However, the conditional content previously displayed is now hidden and the user will not easily find the error in the form.

Expected to show the conditional content on page load.

@tomdoughty
Copy link
Contributor

Hi Nuno,

Are you using the Nunjucks template or the HTML component? I am unable to replicate the issue using Nunjucks. If using HTML you will need to ensure you have handled the setting of classes and IDs manually for the functionality to work.

Also the general layout looks like it will may have accessibility issues caused by nesting fieldsets.

Thanks, Tom

@nunommc
Copy link
Author

nunommc commented May 19, 2020

We're using https://github.com/DFE-Digital/govuk_design_system_formbuilder to generate the HTML for this form. This gem takes care of the classes and IDs and all is working fine in regards to using the conditional. The only issue is when the page is rendered in a state when the content should be expanded but it's not.

@davidhunter08
Copy link
Contributor

davidhunter08 commented May 20, 2020

Hey @nunommc,

The conditional content guidance says:

Keep it simple. If you need to add a lot of content, consider showing it on the next page in the process instead.

I would suggest making the Yes/No question a 'filter question' and using the 'one thing per page principle'.

The questions within the conditional content ("When did your symptoms start?" and "Which symptoms have you experienced?") would become separate pages (one thing per page), fixing your issue. This will also simplify the user interaction by giving users only:

  • 1 question to answer
  • 1 decision they have to make

Also, (like Tom mentioned) having a fieldset within a fieldset is an accessibility issue. See the 'Using the fieldset and legend elements' blog post.

It is possible to nest one fieldset element inside another, but it is not recommended. Screen readers do not automatically indicate the end of the fieldset element, so it is impossible for screen reader users to confidently know which fields belong within which fieldset.

I hope this helps.

@tomdoughty
Copy link
Contributor

Hi Nuno,

As far as I can see in the documentation the form builder is not made to work with NHS.UK Frontend. Any work needed to make it work would need to be in the form builder codebase.

NHS.UK Frontend cannot be switched like for like with GOV.UK Design System. Since NHS.UK was created as a fork of GOV.UK both libraries have grown in their own ways to address their own user needs.

@WorkSutton
Copy link

Hi @tomdoughty - there is a beta version of the Beta form builder for CTAS project which was adapted by Peter Yates.
Was this the version you were looking at?

@WorkSutton
Copy link

Hey @nunommc,

The conditional content guidance does say:

Keep it simple. If you need to add a lot of content, consider showing it on the next page in the process instead.

Also, (like Tom mentioned) having a fieldset within a fieldset is an accessibility issue. See the 'Using the fieldset and legend elements' blog post.

It is possible to nest one fieldset element inside another, but it is not recommended. Screen readers do not automatically indicate the end of the fieldset element, so it is impossible for screen reader users to confidently know which fields belong within which fieldset.

Have you considered making the Yes/No question a 'filter question' and using the 'one thing per page principle'?

So the "When did your symptoms start?" and "Which symptoms have you experienced?" questions would be on separate pages.

This would fix your issue and also simplify the interaction by giving users only:

  • 1 question to answer
  • 1 decision they have to make

I hope this helps.

@davidhunter08 I have addressed your suggestion around accessibility with a colleague who is focused on this area. Thank you.

@tomdoughty
Copy link
Contributor

Hi @tomdoughty - there is a beta version of the Beta form builder for CTAS project which was adapted by Peter Yates.
Was this the version you were looking at?

Hi @WorkSutton
It wasn't but now from what I can see (maybe wrong as I haven't really got much experience with Ruby) it looks like it is relying on the markup and JavaScript of NHS.UK and GOV.UK design systems being the same.
If the app used the latest markup and JavaScript from NHS.UK Frontend then the issue should not occur.

@chrimesdev
Copy link
Member

This looks like it could be a potential issue with the way the form is being put together, it's expected that users write their own logic for error messages and error summaries, this would also be the case to display the conditional reveals on error.

It seems this is being picked up as part of the form builder repo - are we happy to close this issue?

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

No branches or pull requests

5 participants