Skip to content

radio: Keep a disabled Radio disabled inside a RadioGroup - #3331

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
Bombatomica64:fix/radio-group-disabled-item
Oct 1, 2026
Merged

huacnlee merged 1 commit into
longbridge:mainfrom
Bombatomica64:fix/radio-group-disabled-item

Conversation

@Bombatomica64

@Bombatomica64 Bombatomica64 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3324

Description

RadioGroup::render applied the group's disabled flag to every child with radio.disabled(disabled), which overwrote a Radio's own .disabled(true). A disabled option in an enabled group looked enabled and could be selected.

An item is now disabled when it or the group is: radio.disabled(disabled || item_disabled). A disabled group still disables every item.

Screenshot

Screen recordings on Android (Redroid, dark theme) of a RadioGroup whose "XL" item is .disabled(true), tapping XL, then M, then XL, Kit 0.7.0 with and without this diff.

Before

pr3331-before.mp4

After

pr3331-after.mp4

Before: XL renders enabled and each tap selects it (horizontal=Some(3)). After: XL renders disabled and taps do nothing, while M still selects normally.
Builds: demo-pr3331.

How to Test

  • New radio_group_keeps_a_disabled_item_disabled in crates/kit/tests/controls.rs: clicking a disabled item in an enabled group leaves the selection unchanged, clicking an enabled item selects it, and in a disabled group an enabled item cannot be selected. On main it fails with the disabled item selected (Some(1)).
  • cargo test -p gpui-kit --features test-support,component --test controls: 8 passed.
  • cargo test -p gpui-component --features test-support --lib radio: 2 passed.

Note: I first tried to assert on TestElement::disabled(), but it is not populated for Radio or Checkbox (the existing locked Checkbox test also expects None), so the test checks behaviour instead.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes. (Not run: no desktop session here; see How to Test.)
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) (not platform-specific)

Thanks for taking the time to review this.

🤖 Generated with Claude Code

RadioGroup applied its own disabled flag to every child, overwriting a
Radio's .disabled(true), so a disabled option looked enabled and could
be selected. Combine the two: an item is disabled if it or the group is.

Closes longbridge#3324

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 07:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Bombatomica64

Bombatomica64 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

I've added before/after screen recordings to the Screenshot section (Android, dark theme, Kit 0.7.0 with and without this diff; tapping XL (disabled), M, then XL).

Before

pr3331-before.mp4

After

pr3331-after.mp4

@huacnlee
huacnlee merged commit 1be572b into longbridge:main Oct 1, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RadioGroup: a disabled Radio item can still be selected

3 participants