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

[OF#5086] Fix showing soft requirement warning in hidden components #795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vaszig
Copy link
Contributor

@vaszig vaszig commented Feb 17, 2025

@vaszig vaszig added the needs-backport Fix must be backported to stable release branch label Feb 17, 2025
Copy link

codecov bot commented Feb 17, 2025

Bundle Report

Changes will increase total bundle size by 146 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@open-formulieren/sdk-OpenForms-umd 4.78MB 73 bytes (0.0%) ⬆️
@open-formulieren/sdk-esm 4.75MB 73 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @open-formulieren/sdk-OpenForms-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
open-*.js 73 bytes 3.49MB 0.0%

Files in open-*.js:

  • ./src/formio/components/SoftRequiredErrors.js → Total Size: 1.95kB
view changes for bundle: @open-formulieren/sdk-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/formio-*.js 73 bytes 2.03MB 0.0%

Files in assets/formio-*.js:

  • ./src/formio/components/SoftRequiredErrors.js → Total Size: 1.95kB

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.18%. Comparing base (f2afabf) to head (cea8518).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #795      +/-   ##
==========================================
+ Coverage   83.90%   84.18%   +0.27%     
==========================================
  Files         246      246              
  Lines        4816     4819       +3     
  Branches     1282     1282              
==========================================
+ Hits         4041     4057      +16     
+ Misses        746      733      -13     
  Partials       29       29              
Flag Coverage Δ
storybook 77.86% <100.00%> (+0.33%) ⬆️
vitest 62.65% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vaszig vaszig force-pushed the of-5086/fix-soft-requirement-shown-in-hidden-fieldset branch from 965f4a3 to 40028f1 Compare February 17, 2025 14:25
Copy link
Contributor

@viktorvanwijk viktorvanwijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor remarks/questions :)

@vaszig vaszig force-pushed the of-5086/fix-soft-requirement-shown-in-hidden-fieldset branch from 40028f1 to 3b142ff Compare February 21, 2025 13:02
@@ -33,7 +33,11 @@ class SoftRequiredErrors extends FormioContentField {
// check which components have an empty value
for (const component of softRequiredComponents) {
const isEmpty = component.isEmpty();
if (isEmpty) missingFieldLabels.push(component.label);
const isParentVisible = component.parent?.visible;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what it the grand parent is hidden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right I didn't think about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some research I saw that even if we have nested components this works. If, as you mentioned, the grand parent is hidden, all the children are hidden as well. I understood that formio (the UI) does not render the children of a hidden component, even if the json configuration has hidden=false.

Copy link
Member

@sergei-maertens sergei-maertens Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct - I just didn't know if component.visible took into account is parents or not :) So, do we then need the isParentVisible check or not? I'd expect that component.visible already checks that, no?

@vaszig vaszig force-pushed the of-5086/fix-soft-requirement-shown-in-hidden-fieldset branch from 3b142ff to cea8518 Compare February 27, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport Fix must be backported to stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Soft requirement of uploads in field-set trigger warning when not visible
3 participants