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

On first interaction the last Radio item in a Radio group is always selected #476

@IanMatthewHuff

Description

@IanMatthewHuff

Describe the bug

We're currently using the <VSCodeRadioGroup> and <VSCodeRadio> controls in a VS Code Webview. When you first try to click on any of the Radio Buttons the last button in the list will always be selected. After this first click / selection it will then work correctly from now on out.

To reproduce

We are using the React Components in a webview, but I can reproduce this with the radio-group-sample CodeSandbox provided by this repo.

  1. Open this website: https://codesandbox.io/s/radio-group-sample-5c8rq2?file=/index.html
  2. Attempt to click the first or second item in one of the radio groups
  3. To repro again, just reload the browser in the codesandbox

Expected behavior

The radio control that is clicked should be selected.

Current behavior

The last radio control in the group is selected.

Screenshots

RadioIssue

Also this is non-blocking and I'm far from an HTML guru (so I might be misunderstanding).
But per the docs here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event

When a <input type="checkbox"> element is checked or unchecked (by clicking or using the keyboard);
When a <input type="radio"> element is checked (but not when unchecked);

I hooked up to the onChange of <VSCodeRadio> and currently I see it firing for the radio button that is being deselected or switched away from, and from the radio button that is being switched to. Per the docs I would have expected it only for the item that is being switched to.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas workaroundA bug or feature request that has a workaround.upstream issueA blocked issue that is caused by an upstream issue in FAST

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions