Reason for setting states_wrapper to TRUE

Created on 4 October 2023, 9 months ago
Updated 15 April 2024, 2 months ago

Problem/Motivation

When adding states to the element (like required or visible), the wrapper around is adjusted, not the input-element itself. For visibility that might be ok, but for required.
This can "fixed" by setting the states_wrapper-property of the WebformElement-annotation to FALSE, but I'm wondering why this was set to TRUE in the first place. I can understand that it has added value for complex elements like custom composites or addresses, but not for a regular textfield. Can you explain this choice?

Steps to reproduce

- Create a Webform
- Add a couple of fields:
-- A select-element
-- A webform_belgian_national_insurance_number-field, configure it to be visible and required for a certain value of the select-element
-- A text field, configure it to be visible and required for a certain value of the select-element
- Open the webform
- Select the value that makes the other elements visible

Proposed resolution

- Set the states_wrapper to FALSE

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium lammensj

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024