Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit f22b1b0

Browse files
Update radio docs (#511)
Description of changes Update radio docs (and associated CodeSandbox demos) to discuss and provide a warning about the upstream bug described in #476 and offer/demonstrate a workaround fix.
1 parent 4554f79 commit f22b1b0

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

src/radio-group/README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ While any DOM content is permissible as a child of the `vscode-radio-group`, onl
3838

3939
### Basic Radio Group
4040

41+
> **Warning**<br>
42+
> There is a [known upstream bug](https://github.com/microsoft/vscode-webview-ui-toolkit/issues/476) with `vscode-radio` component selection on first interaction. A workaround fix is to make sure that all radio components have a unique `value` attribute applied as demonstrated below.
43+
4144
```html
4245
<vscode-radio-group>
4346
<label slot="label">Radio Group Label</label>
44-
<vscode-radio>Radio Label</vscode-radio>
45-
<vscode-radio>Radio Label</vscode-radio>
46-
<vscode-radio>Radio Label</vscode-radio>
47+
<vscode-radio value="value-1">Radio Label</vscode-radio>
48+
<vscode-radio value="value-2">Radio Label</vscode-radio>
49+
<vscode-radio value="value-3">Radio Label</vscode-radio>
4750
</vscode-radio-group>
4851
```
4952

@@ -52,9 +55,9 @@ While any DOM content is permissible as a child of the `vscode-radio-group`, onl
5255
```html
5356
<vscode-radio-group disabled>
5457
<label slot="label">Radio Group Label</label>
55-
<vscode-radio>Radio Label</vscode-radio>
56-
<vscode-radio>Radio Label</vscode-radio>
57-
<vscode-radio>Radio Label</vscode-radio>
58+
<vscode-radio value="value-1">Radio Label</vscode-radio>
59+
<vscode-radio value="value-2">Radio Label</vscode-radio>
60+
<vscode-radio value="value-3">Radio Label</vscode-radio>
5861
</vscode-radio-group>
5962
```
6063

@@ -63,9 +66,9 @@ While any DOM content is permissible as a child of the `vscode-radio-group`, onl
6366
```html
6467
<vscode-radio-group name="example-radio-group">
6568
<label slot="label">Radio Group Label</label>
66-
<vscode-radio>Radio Label</vscode-radio>
67-
<vscode-radio>Radio Label</vscode-radio>
68-
<vscode-radio>Radio Label</vscode-radio>
69+
<vscode-radio value="value-1">Radio Label</vscode-radio>
70+
<vscode-radio value="value-2">Radio Label</vscode-radio>
71+
<vscode-radio value="value-3">Radio Label</vscode-radio>
6972
</vscode-radio-group>
7073
```
7174

@@ -76,16 +79,16 @@ If the orientation attribute is not set, the default orientation is `horizontal`
7679
```html
7780
<vscode-radio-group orientation="vertical">
7881
<label slot="label">Radio Group Label</label>
79-
<vscode-radio>Radio Label</vscode-radio>
80-
<vscode-radio>Radio Label</vscode-radio>
81-
<vscode-radio>Radio Label</vscode-radio>
82+
<vscode-radio value="value-1">Radio Label</vscode-radio>
83+
<vscode-radio value="value-2">Radio Label</vscode-radio>
84+
<vscode-radio value="value-3">Radio Label</vscode-radio>
8285
</vscode-radio-group>
8386

8487
<vscode-radio-group orientation="horizontal">
8588
<label slot="label">Radio Group Label</label>
86-
<vscode-radio>Radio Label</vscode-radio>
87-
<vscode-radio>Radio Label</vscode-radio>
88-
<vscode-radio>Radio Label</vscode-radio>
89+
<vscode-radio value="value-1">Radio Label</vscode-radio>
90+
<vscode-radio value="value-2">Radio Label</vscode-radio>
91+
<vscode-radio value="value-3">Radio Label</vscode-radio>
8992
</vscode-radio-group>
9093
```
9194

@@ -94,8 +97,8 @@ If the orientation attribute is not set, the default orientation is `horizontal`
9497
```html
9598
<vscode-radio-group readonly>
9699
<label slot="label">Radio Group Label</label>
97-
<vscode-radio>Radio Label</vscode-radio>
98-
<vscode-radio>Radio Label</vscode-radio>
99-
<vscode-radio>Radio Label</vscode-radio>
100+
<vscode-radio value="value-1">Radio Label</vscode-radio>
101+
<vscode-radio value="value-2">Radio Label</vscode-radio>
102+
<vscode-radio value="value-3">Radio Label</vscode-radio>
100103
</vscode-radio-group>
101104
```

src/radio/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ For guidelines on usage in an extension, see the [vscode-radio-group](../radio-g
4444
```html
4545
<vscode-radio disabled>Radio Label</vscode-radio>
4646
```
47+
48+
### Value Attribute
49+
50+
```html
51+
<vscode-radio value="some-value">Radio Label</vscode-radio>
52+
```

0 commit comments

Comments
 (0)