[Bug]: fluent-radio-group ignores value changes while disabled

Đang mở Phù hợp với người mới
#37,198 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@chrisdholt đang làm issue này rồi.

Từ ngày 24/11/2026.

  • #37199 của @pkryusuf — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Mở radio-group.base.ts và đọc getter enabledRadios, accessor set value(), checkRadio() và disabledChanged(); cách sửa là phân giải giá trị đầu vào dựa trên tất cả các radio (không chỉ những radio đang bật) và giữ chỉ số đã chọn nhất quán qua disabledChanged(). Hãy tái hiện trước bằng đoạn HTML trong issue ở story hoặc trang kiểm thử của radio-group, để quan sát value bị bỏ qua khi đang bị vô hiệu hóa. Hoàn thành khi radio được chọn bám theo value, dù nhóm hay radio đích bị vô hiệu hóa, và có một test trong file kiểm thử của radio-group bao phủ điều này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Fluent UI WC (v3) web-components
Component

RadioGroup

Package version

3.2.1 (same logic on main)

@microsoft/fast-element version

3.0.4

Environment

Any browser. Found via Fluent UI Blazor v5, which wraps fluent-radio-group.

Current Behavior

While the group is disabled (or the target radio is disabled), setting value on fluent-radio-group is ignored and the previously checked radio stays checked.

In radio-group.base.ts, enabledRadios returns [] when the group is disabled and leaves out disabled radios. set value() looks up the new value with enabledRadios.findIndex(...) and checkRadio() only updates enabledRadios, so nothing matches. disabledChanged() resets checkedIndex, which also has no effect at that point.

Expected Behavior

The checked radio follows value even when the group or the target radio is disabled. Disabled should block user interaction, not programmatic value changes.

Reproduction

https://github.com/microsoft/fluentui-blazor/issues/5639

Steps to reproduce
<fluent-radio-group id="g" value="a">
  <fluent-radio value="a">A</fluent-radio>
  <fluent-radio value="b">B</fluent-radio>
</fluent-radio-group>
<script>
  const g = document.getElementById('g');
  g.disabled = true;
  g.value = 'b';
  // expected: radio "b" is checked, actual: radio "a" stays checked
</script>

The same happens when the group is enabled but radio "b" has disabled.

Are you reporting an Accessibility issue?

None

Suggested severity

Medium - Has workaround

Products/sites affected

Fluent UI Blazor (FluentRadioGroup). Workaround there is @key to recreate the element. Blazor-side workaround PR: https://github.com/microsoft/fluentui-blazor/pull/5658

Are you willing to submit a PR to fix?

yes

Validations
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Ngôn ngữ chính
TypeScript
Star
20.4k
Fork
3k
Merge trung bình
3 ngày 15 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/fluentui

Tất cả issue của microsoft/fluentui

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.