mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
7362739f94
## Summary Addresses the selected radio dot alignment reported as the second issue in #62955 (ask_user formatting issues), which is already closed. Merged PR #63656 fixed long option wrapping by removing label truncation. That fix was already present in this branch base. This PR keeps option text rendering unchanged while fixing the remaining radio alignment issue and extracting the radio behavior into a reusable UI component. Original Issue: <img width="1672" height="844" alt="image" src="https://github.com/user-attachments/assets/54422dec-f35a-4b83-b16c-831e8755cf50" /> After #63656: <img width="769" height="386" alt="image" src="https://github.com/user-attachments/assets/f659f518-2b4a-47cc-8e2d-c9d46bbdbe10" /> After: <img width="777" height="385" alt="Screenshot From 2026-09-07 18-05-16" src="https://github.com/user-attachments/assets/71ee9343-9623-46bc-8be8-09667fab89b6" /> ## Implementation - Add a reusable `ui::RadioButton` component that owns the full option-row hit target, click handling, focus-visible styling, configurable tab index, accessibility role/state, and theme-derived radio styling. - Keep the elicitation form responsible for selection state and the selection callback while moving the radio control mechanics into `crates/ui`. - Paint the outer radio circle and selected dot from the same pixel-snapped bounds instead of independently laid-out elements. - Derive the dot using equal whole-device-pixel insets so the outer circle and selected dot remain concentric when rounded device-pixel diameters have different parity. - Preserve the original `size_3()` visual radio inside the 20px control slot, while the full row remains clickable. - Provide an explicit accessible label for each radio option and expose the selected state through `Role::RadioButton` / `aria_selected`. - Preserve the existing elicitation row spacing, hover styling, long-option layout, and keyboard navigation behavior. ## Scope This PR does **not** re-enable the `ask_user` tool or change its default profile settings. The tool remains opt-in following #63036. Subagent question visibility and broader radio-group behavior such as arrow-key/roving-tab-index navigation are outside this change. ## Validation - `cargo check -p ui -p agent_ui` passed. - `cargo test -p agent_ui form_choices_are_keyboard_accessible -- --nocapture` passed. - `rustfmt --edition 2024 --check crates/ui/src/components/radio_button.rs crates/ui/src/components.rs crates/agent_ui/src/conversation_view/elicitation.rs` passed. - `git diff --check` passed. - Built and ran the updated application locally. - Manually verified the single-select UI with short and long options: the selected dot is centered, the visual radio retains its original size, long option text wraps correctly, and the row layout remains intact. - Other display scales have not been visually verified. Release Notes: - Fixed selected radio indicator alignment in agent elicitation forms. --------- Co-authored-by: MrSubidubi <finn@zed.dev>