Problem/Motivation
The radios elements that are provided by core do not apply the required attribute to the generated <input> elements. Instead the required attribute is applied to the wrapping <fieldset>.
There are two issues with this:
- screen readers use
requiredattribute on<input type="radio">. If the attribute is not present on the , then the required state will not be communicated to the screen reader user. - the
requiredattribute is not valid when applied to a<fieldset>, thus causing the page to fail W3C validation.
Proposed resolution
- Remove the
requiredattributes from the<fieldset>of Form API radios elements. - Add
requiredattribute to the<input type=radio>elements instead. - CSS updates, to ensure no visual regressions.
Remaining tasks
- Move
requiredattributes from the<fieldset>element to the<input>element. DONE. Add therequired="required"<code> attribute to the <code><input type="radio">elements.- CSS to avoid visual regression. Asterisk should be after the fieldset legend, not the individual radio buttons.
Manual testing tips
We need a required radios element to test this, e.g. add a "favourite colour" field to a content type. Use a field of type "List", mark it required, and use the radios/checkboxes widget under "manage form display".
User interface changes
Markup + CSS changes to
- Fix invalid HTML
- Convey required radio buttons correctly to assistive tech.
- Avoid visual regression.
API changes
None.
Data model changes
None.
Original report by @mfairchild365
This issue is split off from #2950999: Checkboxes element missing "required" attribute. That issue originally addressed radios and checkboxes, but it looks like they need different solutions, so we're using separate issues now.
| Comment | File | Size | Author |
|---|---|---|---|
| #117 | drupal-radios-missing-required-attr-2951317-117.patch | 11.58 KB | jcandan |
Issue fork drupal-2951317
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
andrewmacpherson commentedComment #3
mfairchild365 commentedI wasn't sure if I should unset the required attributes (required, aria-required, and aria-invalid) from all fieldsets, or just the fieldset for radios. The required attribute is technically invalid on all fieldsets.
Comment #4
mfairchild365 commentedComment #6
mfairchild365 commentedComment #7
mfairchild365 commentedComment #8
mfairchild365 commentedComment #9
mfairchild365 commentedThe last commit had a file permission change that should not have beed added.
Comment #10
andrewmacpherson commentedThanks for working on this @mfairchild365.
Manual testing of patch #9:
Code Review of patch #9. Looking good so far, with a few minor issues:
The first line added here had some trailing spaces in it, which should be removed for coding standards.
Use a space after the the double slash to start the comment, and split this into two lines, wrapping at 80 characters.
I think this comment could be worded better. The word "invalid" sounds ambiguous here, because that's like the name of one of the attributes. Perhaps "Remove unnecessary attributes ..."?
&& 'radios' === $variables['element']['#type'])We don't generally see Yoda conditions in Drupal. Not actually part of our PHP coding standards yet, but being discussed in #2372543: [policy, no patch] Explicitly disallow yoda conditions. Until that's resolved it's probably best to stick to the non-Yoda way.
Good catch. I think this is appropriate. AFAIK aria-invalid doesn't work on fieldset elements.
TODO: update CSS to fix the issue of too many asterisks. This comes from
form.cssin Classy theme, so let's try updating that, to avoid adding the asterisk it to required radios which are inside fieldsets (not sure how specific it will need to be). The framework maintainers might say no to changing Classy, in which case we can put separate overrides in Bartik and Seven. But let's try updating Classy CSS first for simplicity.Comment #11
mfairchild365 commentedThank you for the review @andrewmacpherson
A new patch is attached which addresses all of your concerns.
Comment #12
mfairchild365 commentedComment #13
andrewmacpherson commented@mfairchild365 - thanks for the patch in #11.
A few tips for contributions generally:
Comment #14
andrewmacpherson commentedReview of patch #11. Good progress!
The
.form-radiostargets the div wrapper which around the radio options, but inside the fieldset.The
.form-requiredclass targets the individual labels inside the radios set.The CSS works, and targets FAPI #radios only, so I think this would be fine if we put it in the CSS for Bartik and Seven themes.
But is it safe enough to include in the Classy theme, so that lots of themes benefit? This issue corrects an accessibility problem in markup at the form rendering level, but needs some CSS to avoid a visual regression in any theme inheriting form Classy. I think a more experienced CSS/front-end contributor should answer this better than I can. Leaving at needs review, tagging for others to find.
Comment #15
andrewmacpherson commentedA good one to work on at the Nashville sprints. Novices could try
- Get screenshots form Bartik + Seven, confirm no visual regression
- Get an assessment of whether this is safe enough to include in the Classy theme, to answer my question in the previous comment. Maybe track down a front-end framework manager and ask them in person :-)
- Write a functional test for the markup.
Comment #16
matias commentedManual tested #11 and it looks good on Bartik and Seven
Comment #18
andypostneeds screenshots to compare before-after! #16 provides only after ones, so to be sure we need initial state
Comment #19
KondratievaS commentedI have tested patch from comment #11 and result is OK
Comment #20
Edwin KnolReviewing from Drupal europe 2018 mentored by @mmbk
Comment #21
Edwin Knol@mfairchild365 While reviewing the code i noticed the following function in form.inc.
We could also choose to not set the attributes instead of unsetting them by overwriting setAttributes() in the class Radios.
I will try this to see if this could work and if so apply a patch.
Comment #22
Edwin KnolAdded Patch let me know what you think.
Comment #23
mmbk@edwin-knol thank you for your work here, for me the result looks good.
I just wonder whether we need some tests here, if not I think it's RTBC
Comment #24
Edwin Knol@mmbk Thanks for your support at Drupal Europe.
What kind of test do you mean ?
User testing or automated test.
Should i be the one to put the issue on RTBC or should this be done by another Community user ?
Comment #25
mmbkI mean automated tests, they were already suggested at #15
No definately not, I'ld like to have a review by a more experienced contributor
Comment #26
Edwin Knol@mmbk I'm not able to find the time to create a test for the markup right now.
Comment #28
2phaJust an FYI for anyone else running into this issue...
You can override the preprocess of the radiobuttons with `MYTHEME_element_info_alter(array &$info)`.
This is the way I had to do it on a project (which required major accessibility) and it seems to work.
eg.
It seems to me this issue should be garnering a lot more attention as no only is it bad for accessibility and screen readers, but it also produces invalid html (required on a fieldset).
Comment #29
mile23Reroll #22 for 8.8.x.
Comment #30
mile23This is not so good a solution because it yields a required marker on all the elements the user could choose from. That could be confusing.
Edit: On second thought, this might be our CSS.
Comment #31
2phaI thought I would chime in here again.
After trying to validate my page, I am being flagged for having aria-required set on radio buttons.
After searching around the interwebs, it seems that a radiobutton group that is required should have a default value.
Comment #32
jrockowitz commentedTo move this patch along I added a test form to the form_test.module.
Below shows the patch from #30 is working when navigating to /form-test/radios-required
@2pha is right the aria-required attribute is not supported by radio buttons. I am not sure what the best approach is going to be to address this issue.
Comment #33
jrockowitz commentedThe patch adds
role="radiogroup"to the radios fieldset wrapper and removes thearia-requiredattribute from individual radio buttons.I think the next step is someone to confirm and verify the requirements. Once we know this is the right direction we can add some test coverage to
\Drupal\Tests\system\Functional\Form\ElementTestComment #34
leraa commentedFor #33: ARIA radiogroup and radio example
Backs up the
role="radiogroup"for fieldset and also addsaria-labelledbyComment #35
leraa commentedI tested this patch and found correct:
aria-required="true"is set on the fieldsetrole="radiogroup"is set on the fieldsetHowever, I still saw
aria-required="true"on the individual radio buttons.Comment #36
jrockowitz commentedThis patch should remove the aria-required.
Comment #37
leraa commentedThis patch confirmed working as expected.
Manual test steps:
aria-required="true"is set on the fieldsetrole="radiogroup"is set on the fieldsetaria-required="true"is NOT on the individual radio buttonsrequired="required"is on the individual radio buttons.
Needs accessibility review.
Comment #38
jrockowitz commentedPatch now hash test coverage.
Comment #39
andrewmacpherson commented@2pha - re. #31:
Good catch, thanks for reporting this.
This is NOT the case as far as I know. The WAI-ARIA recommendation (version 1.0 or 1.1) certainly doesn't state this. The HTML 5.2 recommendation is clear that it is permitted to have a group of radio buttons where none of them is in the checked state (emphasis mine):
The part about "suffering from being missing" is relevant at validation time, but it doesn't mean that there must be a checked radiobutton. when the form is first rendered.
Comment #40
andrewmacpherson commentedThanks for working on this everyone. This issue has taken some twists and turns, and isn't quite right yet. It's had some scope creep, and misunderstandings. Fiddly!
Firstly, my original instructions were faulty. I said we needed to put an
aria-requiredattribute on the<input type"radio">element. That turned out to be incorrect - @2pha and @jrockowitz caught it in #31-32. I've checked the ARIA recs, and I agree. The input element needs arequiredattribute, but not anaria-requiredattribute.Re. #33-#34:
<fieldset role="radiogroup">is invalid. The HTML5.2 recommendation does not list radiogroup as a permitted role on the fieldset element.role="radiogroup"on a fieldset element; the example there is using the radiogroup role on a DIV.<div role="radio">in the example linked to).nameattribute on the input element.aria-requiredattribute either. The default role for a fieldset is "group", for whicharia-requiredisn't permitted. According to HTML5.2, the fieldset element is only allowed ARIA states and properties which would be allowed for the group or presentation roles.Upshot: the fieldset element shouldn't have the radiogroup role, or
aria-required.Re. #37:
The fieldset element has a
requiredattribute in that screenshot, which isn't valid HTML.Testing patch #38:
Before patching:
<fieldset>hasaria-required="true". INCORRECT, not permitted on fieldset, remove it.<fieldset>hasrequired="required". INCORRECT, not permitted on fieldset, remove it.<input type="radio">doesn't have thearia-required="true"attribute. CORRECT, no need for it.<input type="radio">doesn't have therequired="required"attribute. INCORRECT, we need to add this.After patch #38:
<fieldset>hasrole="radiogroup". INCORRECT, not permitted on fieldset per HTML, remove it.<fieldset>hasaria-required="true". INCORRECT, not permitted on fieldset, remove it.<fieldset>hasrequired="required". INCORRECT, not permitted on fieldsest,remove it.<input type="radio">doesn't have thearia-required="true"attribute. CORRECT, no need for it.<input type="radio">has therequired="required"attribute. CORRECT.Needs work:
role="radiogroup"attribute from the fieldset, because it's not a permitted role, per HTM.aria-required="true"attribute from the fieldset, because it's not permitted for the fieldset element's default role of group.required="required"attribute from the fieldset, because it's not valid HTML.Comment #41
andrewmacpherson commentedUpdating proposed resolution and tasks.
Comment #42
2phaA problem I found when having a required attribute on each
<input type="radio"is that screen readers would announce each individual radio button as required, which is confusing.I was / am working on a government website which requires extreme usability. I am testing on 4 different devices with 4 different screen readers. The only option I could find that kept them all happy was to set a default value.
I think it is important that if these changes are going to happen, that it is tested with multiple screen readers and the outcomes are documented. This would probably just mean setting up a page somewhere with the proposed output and testing in JAWS / Talkback / Voiceover etc, then posting the results here.
By testing, I mean validating the html and the expected screen reader announcements.
I could do the testing if needed.
Comment #43
andrewmacpherson commented#42 - I love the term "extreme usability" :-)
It's the normal behaviour of most screen readers to announce each individual radio button as required. The important thing is their radio button role is announced, because that's what conveys the fact that it has a single-selection behaviour for the group. The "required" constraint applies to the group as a whole, so it's fine to repeat this for each radio button. (When you change from one radio option to another, you are still technically on the same control group as far as assistive tech sees it, even if they are separate inputs in HTML terms).
It really isn't necessary to enforce a pre-selected default value for radio buttons. Most screen readers will announce them as "unselected, required" when they are first encountered. As soon as you select one explicitly using the spacebar (or maybe implicitly, using arrow keys; screen readers vary a bit in this) then they are announced as "selected, required" from that point onwards.
I agree that it's important to test with multiple screen reader and browser combinations, and I regularly do. I'm not sure what you mean by "keep them all happy"; that's a bit vague. The experience with each screen reader doesn't have to be identical, and numerous quirks are to be found. They don't all announce fieldsets the same way, or list the number of options. Some announcements are user-configurable. The important thing is that all the necessary information is conveyed in the accessibility tree. There are some combinations of browser and screen reader which have bugs beyond our control, and I don't think it's worth jumping through hoops to satisfy uncommon choices. I usually test IE11, Edge, Firefox, Firefox ESR, Safari, and Chrome browsers, alongside JAWS, NVDA, Narrator, Talkback, and macOS VoiceOver. I could do with more practice with iOS VoiceOver/Safari, which is a popular combination; it has lots of reported quirks and bugs, and has been a bit unstable between different iOS versions.
Comment #44
andrewmacpherson commentedCode review of patch 38:
I think this is the right method to use, but the brute-force override is a bit risky from a long-term maintenance point of view. If
RenderElement::setAttributes()ever changes, then Radio won't get the benefits, and we'd have to replicate some logic again inRadio::setAttributes().The only thing we're interested in changing is the way
requiredandaria-requiredare used, not other attributes like class. It would be safer to override it more like this:This could be phrased better. The important thing is that we're avoiding adding the
aria-requiredattribute to the<input type="radio">element, because it would be invalid HTML/ARIA.I don't rate that stackoverflow question/answer very highly; it has some misleading information, which I've commented about there. Instead, we can refer directly to the HTML5.2 rec, in section "3.2.8.4. Allowed ARIA roles, states and properties" (https://www.w3.org/TR/html52/dom.html#allowed-aria-roles-states-and-prop...).
This preRender callback is the part which produces the invalid
<fieldset role="radiogroup">. It can be removed.This is correct. I wonder if we should also assert that the fieldset element doesn't have the (invalid) HTML
requiredattribute?The assertion about the radiogroup role won't be needed.
Looks good.
I couldn't see where this selector actually matches a DOM element. Is this cruft from an earlier version of the patch?
Comment #45
mfairchild365 commentedA couple of notes, since this is new to me too. The
radiogrouprole is in fact valid on a<fieldset>. See the HTML-ARIA spec for details. Additionally, the W3C is no longer publishing their own version of the HTML spec, and are instead working with WHATWG in their repositority.I recently tested the support of
aria-requiredon theradiogrouprole. It has pretty good support, but using the required attribute on each radio button will most likely yield the most robust support.Comment #46
andrewmacpherson commentedRe. #45: Thanks @mfairchild365.
You're right, that's a nice find! ARIA-in-HTML does say that the radiogroup role is permitted on the fieldset element, but the HTML5.2 rec says it isn't. So these two W3C standards are at odds with each other. The ARIA-in-HTML doc is only a working draft (and I think it's intended to have W3C Note status, rather than Recomendation status), but it's more recent than HTML 5.2. I don't think there's an easy way to square that.
I'm not sure that's relevant; note that the WHATWG version of HTML doesn't offer any opinion on ARIA at all.
I'm not certain what to do about the radiogroup role at this point. I'm inclined to say it's out of scope here, because the central problem in this issue is the way we're indicating the required-ness of the radios, not which container role is most appropriate.
I'm in agreement with that.
I think we have established the following things:
requiredattribute should be present on the input elements, but not on the fieldset element.aria-required="true"attribute can be present on the fieldset element, but not on the input elements.aria-requiredis allowed on elements with either thegroup, orradiogrouprole. So it's permitted on the fieldset element regardless of whether the fieldset can have the radiogroup role.I think it's worth checking these with assistive tech:
<fieldset>and<fieldset role="radiogroup">in the real world, given the discrepancy in the standards.aria-labelledbyalong with the radiogroup role.aria-requiredattribute. (Assuming the individual radio inputs have therequiredattribute.)Comment #49
joseph.olstadwondering if something like this would work as a stop-gap?
Comment #50
maseyuk commentedAnyone looking for a quick solution to this on a custom form you can add the following:
'#attributes' => ['required' => 'required']e.g.
That will add the required attribute to each radio and doesn't mess around with anything else
Comment #51
dpiNot sure where "#radios" / "#checkboxes" came from.
Comment #59
dieterholvoet commentedI opened a MR with a rebased version of 2951317-38.patch.
Comment #60
mgiffordAdding WCAG 1.3.1 Tag.
Comment #61
fenstratAttached is simply a patch version of #59 for use in composer.patches.
Comment #62
mmbkHmm, @fenstrat the widget with the merge request contains a link plain diff that can be used for the composer patches.
Comment #63
akram khanadded patch Fixed some Coding standard issue
Comment #64
akram khanComment #65
fenstrat@mmbk indeed that's how that patch was generated. Linking to diffs from MR's in composer patches is not a good idea. Anyone can change the code it would include by simply pushing to the MR. On your next build you're now including potentially broken, possibly malicious code.
Comment #66
simobm commentedOn 9.3.22 Right now, i had to go with #50, that was the only solution that worked for me.
Comment #67
sonam.chaturvedi commentedVerified and tested patch #63 on 10.1.x-dev. Patch applied cleanly.
Test Result:
1. The
requiredattribute is present on the input elements - CORRECT2. The
aria-required="true"attribute is present on the fieldset element, but not on the input elements - CORRECT3. As per #46,
requiredattribute should not be present on the fieldset elements but it is present - INCORRECTKeeping it to NR to confirm the expected solution.
Please refer attached before and after screenshots
Comment #68
smustgrave commentedReviewing the remaining tasks
Still needs to happen
May still need to happen.
Comment #69
dwwAdding #3267246: ['#states']['required'] broken for radios as related. We should probably fix this issue first, then circle back there to make sure #states works, too. Tagging this bug to be smashed...
Comment #71
larowlanFWIW we discussed this in bug smash hard problems meeting (in conjunction with the related issue dww linked).
Here's a codepen https://codepen.io/larowlan/pen/oNPVEax that demonstrates that putting required on each item is fine as suggested by mstrelan in that meeting.
One thing to think about though is how does a user unset a radio value once set, but I think that impacts the states issue more, will comment there
Comment #73
nevergoneHow can the resolution of this proceed?
Comment #78
acbramley commentedRerolled onto a new 11.x based branch. https://git.drupalcode.org/project/drupal/-/merge_requests/7341
Comment #79
acbramley commentedComment #80
nicolas s. commentedPatch on comment #79 apply in a Drupal 10.2.7
Attribute required appear on html input radio but when you submit a form with a required radio TRUE, we don't have native error message but in console I see a mysterious javascrit error
An invalid form control with name='field_contact_email' is not focusable. <input data-drupal-selector="edit-field-contact-email-1" required="required" type="radio" id="edit-field-contact-email-1" name="field_contact_email" value="1" class="form-radio">Comment #81
gidarai commentedRerolled patch in #62 to work with Drupal 10.3.0
Comment #82
carolpettirossi commentedPatch #81 worked perfectly on Drupal 10.3.0. Thanks for the re-roll.
Comment #83
rajneeshb commentedTested MR:7341 works fine on 11.x
Attaching screenshots for reference.
Comment #84
smustgrave commentedSeems this may still be needed
Rebased the MR as it was 900+ commits back.
Comment #86
joaopauloc.dev commentedHi folks,
I’ve updated the merge request to remove the required attribute from the fieldset for the radio buttons — the aria-required attribute is no longer present, as expected.
I also updated the CSS to ensure that the asterisk (*) still appears in the fieldset legend for radios, even without the required attribute.
Comment #87
joaopauloc.dev commentedI’d like to propose a new variable: has_required_children.
Since the required attribute applies only to individual form elements and not to the fieldset itself, we can’t rely on it directly for fieldsets. This new variable would allow us to handle required state information at the fieldset level, particularly for radio buttons and checkboxes.
With this variable in place, we can also properly manage the required and aria-required attributes for fieldsets used in checkbox elements.
Comment #88
smustgrave commentedIf a new variable is being added think it needs to be mentioned in the IS. But is that for sure the only way? By doing a twig template change we will need a CR as this fix won't hit contrib or custom themes. Ideally if possible if this can be determined before twig that would be best.
Comment #90
aalin commentedfor anyone who has faced this, the patch from merge request 2951317-11.x (https://git.drupalcode.org/project/drupal/-/merge_requests/7341.patch) does not apply to 11.2.2. However, the diff file (https://git.drupalcode.org/project/drupal/-/merge_requests/7341.diff) works fine.
I also tried merging 11.x into 2951317-11.x, but had the same issue.
Comment #91
acbramley commentedI've pushed a change so we don't need the new twig variable.
I'm also unsure if the CSS changes are needed anymore. I've tested both on Claro and Olivero with and without these changes and everything looks identical since we're simply allowing the form-required class to be added on the fieldset legend without the fieldset itself being required.
Comment #92
nicolas.hod commentedWe can't apply the patch from merge request (https://git.drupalcode.org/project/drupal/-/merge_requests/7341.patch) anymore on drupal 11.1.6
Comment #93
joaopauloc.dev commentedI tested the latest changes of the merge request and works as expected.
I follow this steps.
- Create a new instance of Drupal 11.3
- Add in the basic page content type a list text field with 3 options and make it required field.
Without the changes, the required is in incorrect position and there is no validation after submit.


Wrong required attributes.
After changes applied.


Required attributes in the correct elements
Comment #94
quietone commentedTriaging the RTBC queue.
I have not read all the comments but nothing stood out as incomplete in a skim. I read the MR and made some suggested changes so setting to needs work for that. Also, the issue summary is out of date. If refers to 'aria-required' which is not in the MR and to Seven and Bartik which are no longer i core. Tagging for an IS update.
Comment #96
acbramley commentedComment #97
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #98
acbramley commentedComment #99
dcam commentedAn assertion for the
fieldgroupattribute was removed by commitb0953653, in between comments #85 and #86. So this feature is currently untested. I read through the comments about the attribute. It's clear that its addition was contentious. So that's something for accessibility reviewers to consider. But the attribute either needs to be tested or removed. I'm setting the issue to Needs Work for this.I also noticed that there are CSS additions to Claro and the Starterkit themes. Are these changes something that all themes will need to implement? Because that will require a change record.
Comment #100
kentr commentedComment #101
rkolleri wanted to test the current state of the MR, but after checkout i ran into fatal errors due to recent changes in 11.x
Fatal error: Uncaught Error: Class "Doctrine\Common\Annotations\TokenParser" not found in /var/www/html/repos/drupal/core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php:192the MR probably needs a rebase
Comment #102
acbramley commentedComment #104
kentr commentedComment #105
drupalite1411 commentedHi All,
I am using drupal 10.6.7 and I have created a patch using the code in the latest MR.In the latest MR, Drupal 11 has core/lib/Drupal/Core/Form/FormPreprocess.php while in D10 we have corresponding code in form.inc.
My custom patch worked fine and resolved accessibility issue we were facing due to aria-required attribute in fieldset. Apart from this patch -
I have also tested the latest MR in Drupal 11 in simplytest site but it does not apply.
Could someone update what is going on with this issue?
Comment #107
drupalite1411 commentedComment #109
drupalite1411 commentedI have noticed one more thing, webform fieldset now getting 'error' class and aria-invalid="true" after applying this patch.
<fieldset data-drupal-selector="edit-test" id="edit-test--wrapper" class="radios--wrapper fieldgroup form-composite webform-composite-visible-title error js-webform-type-radios webform-type-radios js-form-item form-item js-form-wrapper form-wrapper" role="radiogroup" aria-invalid="true" data-once="webform-radios-required">This is because of the code in core/lib/Drupal/Core/Render/Element/Radios.php in latest MR
Comment #113
jcandan commentedAs noted #3267246-25: ['#states']['required'] broken for radios...
I agree that the required attribute and class handling should follow WCAG (see here, here).
Since this issue changes initial class and attribute placement, it should also handle state changes.
Kicked off a new MR spun from an updated
mainbranch. Also addedstates:requiredsupport.Comment #115
jcandan commentedSeems we're failing a test.
Behat\Mink\Exception\ElementNotFoundException: Element matching css ".views-messages" not found..Drupal\Tests\views_ui\FunctionalJavascript\ConfigHandlerExtraFormTest::testExtraOptionsModalValidation().$assert->elementTextEquals('css', '.views-messages', 'Error message Selection type field is required.');Comment #116
jcandan commentedThe current direction looks good, but based on testing downstream in Conditional Fields and Require on Publish, I think we should revisit one part of the dynamic
_nonehandling.We may need another change here. When a radio group becomes required, we should hide/show the
_noneoption, but we should not force its checked state on state change, which I think I currently do in this latest MR update.In other words:
_none_none_noneThat keeps the UI behavior predictable and avoids introducing extra state changes during the transition. If
_nonewas selected before being hidden, it should remain selected while hidden and still be there when shown again. If it was not selected, we do not need to select it programmatically.I think that makes the states behavior cleaner and avoids conflating visibility changes with value changes.
Comment #117
jcandan commented