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

Conditinally displayed form group is initially visible #970

Closed
niekvanderreest opened this issue Feb 8, 2023 · 2 comments
Closed

Conditinally displayed form group is initially visible #970

niekvanderreest opened this issue Feb 8, 2023 · 2 comments

Comments

@niekvanderreest
Copy link

niekvanderreest commented Feb 8, 2023

Display bug when a form has conditional display for a form group set.
Forms v10.2.1

Bug summary

There is no initial display: none style set in form.cshtml for form groups. When loading the page, the group and all questions in it will 'flash' shortly before being hidden by scripting.

Steps to reproduce

  • Create a group on a form and set it to show/hide based on a previous answer.
  • Add the form to a page ensuring it is at the very top and visible without scrolling.
  • Load the page and withnes a 'flash' before the questions are hidden.

Expected result

The page and contained form load with an initial state for the group of either being visible or not.

Actual result

A notible 'flash' of the content being hidden is seen

@niekvanderreest
Copy link
Author

I've fixed the issue on a custom theme by adding a style="display:none" tag based on show condition.
This change is made in the view Form.cshtml at line: 36 (ish), see attached screenshot.

image

The logic is a copy paste from the same Form.cshtml on line: 52 (ish), where it is used to set initiall hidden state on individual questions.

@AndyButland
Copy link

Thanks for the report @niekvanderreest (and the fix!). Looks quite correct what you have done to me, and seems we've just missed applying this initial visibility to the fieldsets as we have done with fields.

Your fix will be applied to the default theme from the next release.

I'll mark this to be included in the next patch release, but, depending on timings, it might just get rolled up into the next minor.

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

No branches or pull requests

2 participants