vscode-webview-ui-toolkit icon indicating copy to clipboard operation
vscode-webview-ui-toolkit copied to clipboard

VSCodeRadio cannot be checked in the first rendering

Open kevin-s-wang opened this issue 3 years ago • 3 comments

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: image

Current behavior

None of the VSCodeRadios is checked in the first rendering: image

However, the second rendering of the components is correct: image

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

kevin-s-wang avatar Sep 14 '22 03:09 kevin-s-wang

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 avatar Sep 26 '22 19:09 hawkticehurst

@hawkticehurst yes, I'm using react toolkit.

kevin-s-wang avatar Oct 11 '22 06:10 kevin-s-wang

Have you tried providing values?

              <VSCodeRadioGroup value='a'>
                <VSCodeRadio value='a'>True</VSCodeRadio>
                <VSCodeRadio value='b'>False</VSCodeRadio>
              </VSCodeRadioGroup>

quark-zju avatar Aug 19 '23 05:08 quark-zju