vscode-webview-ui-toolkit
vscode-webview-ui-toolkit copied to clipboard
VSCodeRadio cannot be checked in the first rendering
Describe the bug
React VSCodeRadio cannot be checked in the first rendering, but it's checked in the second rendering.
To reproduce
<h2>{checkIt && 'True'}</h2>
<div>
<input name='test' type='radio' checked={checkIt} />
<label>True</label>
</div>
<div>
<input name='test' type='radio' checked={!checkIt} />
<label>False</label>
</div>
<VSCodeRadioGroup>
<VSCodeRadio checked={ checkIt } >True</VSCodeRadio>
<VSCodeRadio checked={ !checkIt }>False</VSCodeRadio>
</VSCodeRadioGroup>
Expected behavior
The first radio should be checked:

Current behavior
None of the VSCodeRadios is checked in the first rendering:

However, the second rendering of the components is correct:

Also, I've tried to set checked={true}, it's the same behavior
Screenshots
Please see the above descriptions
Desktop (please complete the following information):
- OS Version: [e.g.
macOS 12.5.1] - Toolkit Version: [e.g.
v1.0.1]
Additional context
Thanks again for the bug report @kevin-s-wang!
Like the other issue, I just wanted to confirm that you're using the React toolkit components correct?
Regardless, I'll make sure to put this and your other bug report at the top of my list once I have some free cycles to work on this
@hawkticehurst yes, I'm using react toolkit.
Have you tried providing values?
<VSCodeRadioGroup value='a'>
<VSCodeRadio value='a'>True</VSCodeRadio>
<VSCodeRadio value='b'>False</VSCodeRadio>
</VSCodeRadioGroup>