Repository navigation
studio/frontend: correct Think pill aria-label before model loads - #5655
Conversation
`reasoningEnabled` defaults to true in the chat-runtime store, so on a fresh /chat with no model the Think pill renders disabled + visually off (LightbulbOffIcon, data-active="false"), but its aria-label still reads "Disable thinking" -- screen readers announce it as if the button is currently on. Add a `disabled` branch between reasoningLockedOn and effectiveReasoningEnabled so the label reads "Thinking (model not loaded)" while the button is unreachable, then falls through to the normal enable/disable copy once a model is loaded. Apply the same fix to the equivalent pill in shared-composer (where the disabled flag is named `reasoningDisabled`).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e60a8bbca2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| : disabled | ||
| ? "Thinking (model not loaded)" |
There was a problem hiding this comment.
Distinguish unsupported reasoning from unloaded model
This new disabled branch conflates two different states in ReasoningToggle: disabled is true both when no model is loaded and when the loaded model does not support reasoning (const disabled = !(modelLoaded && effectiveSupportsReasoning)), so screen readers now hear "Thinking (model not loaded)" even for loaded non-reasoning models. That introduces an incorrect accessibility announcement and regresses state accuracy compared with the intended fix; the label should key off !modelLoaded specifically (or otherwise represent unsupported reasoning separately).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review
This pull request updates the aria-label for reasoning toggles in thread.tsx and shared-composer.tsx to handle cases where reasoning is unavailable. Feedback indicates that the label "Thinking (model not loaded)" is misleading when a model is loaded but lacks reasoning support, and suggests differentiating between these states to provide more accurate accessibility feedback.
| : disabled | ||
| ? "Thinking (model not loaded)" | ||
| : effectiveReasoningEnabled | ||
| ? "Disable thinking" | ||
| : "Enable thinking" |
There was a problem hiding this comment.
The aria-label "Thinking (model not loaded)" is used whenever disabled is true. However, disabled is defined as !(modelLoaded && effectiveSupportsReasoning), which means it also covers cases where a model is loaded but simply doesn't support reasoning. In such cases, the label would be misleading for screen reader users. It's better to distinguish between the model not being loaded and the feature not being supported by the loaded model.
: !modelLoaded
? "Thinking (model not loaded)"
: disabled
? "Thinking (not supported)"
: effectiveReasoningEnabled
? "Disable thinking"
: "Enable thinking"
| : reasoningDisabled | ||
| ? "Thinking (model not loaded)" | ||
| : effectiveReasoningEnabled | ||
| ? "Disable thinking" | ||
| : "Enable thinking" |
There was a problem hiding this comment.
Similar to the logic in thread.tsx, the aria-label "Thinking (model not loaded)" is applied whenever reasoningDisabled is true. Since reasoningDisabled includes models that are loaded but lack reasoning support, this label can be inaccurate. Splitting the condition provides more precise accessibility feedback.
: !modelLoaded
? "Thinking (model not loaded)"
: reasoningDisabled
? "Thinking (not supported)"
: effectiveReasoningEnabled
? "Disable thinking"
: "Enable thinking"
|
Targeted fix is correct. Verified by installing this PR head into a temp Studio workspace and probing with Playwright:
One follow-up edge case I'd flag (not introduced by this PR, but the new wording makes it more visible): The condition Cheap follow-up (separate PR, since the scope here is only the "before model loads" case): : !modelLoaded
? "Thinking (model not loaded)"
: !effectiveSupportsReasoning
? "Thinking is not supported by this model"
: effectiveReasoningEnabled
? "Disable thinking"
: "Enable thinking"For this PR's stated scope (resolves the contradictory |
… reasoning Address review feedback on #5655 (chatgpt-codex-connector + gemini-code-assist both flagged the same edge case): The previous `disabled` branch labeled the Think pill "Thinking (model not loaded)" whenever the button was disabled, but `disabled` is defined as `!(modelLoaded && effectiveSupportsReasoning)` (in thread.tsx) and `!modelLoaded || !effectiveSupportsReasoning` (in shared-composer.tsx). Both cover the second case where a model IS loaded but does not support reasoning at all (e.g. Llama-3.2-1B-Instruct), which mislabeled the pill for screen-reader users. Split the branch so the no-model case keeps "Thinking (model not loaded)" and the loaded-but-unsupported case reads "Thinking (not supported by this model)". Locked-on / enabled / disabled labels are unchanged. Verified by re-running the Playwright probe: - no model -> aria-label "Thinking (model not loaded)" - Llama-3.2-1B loaded -> aria-label "Thinking (not supported by this model)" - reasoning-capable loaded, OFF -> "Enable thinking" - reasoning-capable loaded, ON -> "Disable thinking" - locked-on model -> "Thinking is required for this model"
|
Follow-up commit The previous "Thinking (model not loaded)" label was applied whenever Split the branch in both reasoningLockedOn
? "Thinking is required for this model"
: !modelLoaded
? "Thinking (model not loaded)"
: disabled // or reasoningDisabled in shared-composer
? "Thinking (not supported by this model)"
: effectiveReasoningEnabled
? "Disable thinking"
: "Enable thinking"States covered:
tsc + |
…pdown pre-load mislabel Address review consensus on #5655: 1. Extract the duplicate 5-branch aria-label conditional into a shared helper `thinkToggleAriaLabel` (plus a parallel `thinkEffortAriaLabel` for the reasoning-effort dropdown). Both `thread.tsx` and `shared-composer.tsx` now import from `components/assistant-ui/think-aria-label.ts`. 2. While reviewing the diff, an Opus reviewer noticed the same conceptual bug existed in the reasoning-effort dropdown branch in `thread.tsx:627` (the alternate render path used by Claude-style models with effort levels): before a model loaded, the aria-label announced e.g. "Reasoning effort: medium" on a disabled, grayed-out button. Same contradiction as the original bug for the on/off toggle. Now routed through `thinkEffortAriaLabel`, which falls back to "Thinking (model not loaded)" / "Thinking (not supported by this model)" while the button is unreachable and only emits the effort label when the model is loaded and actually supports reasoning. 3. Locked-on stays intentionally absent from `thinkEffortAriaLabel`: the dropdown remains interactive in that case (users can still pick an effort level), so the per-level label is the right announcement. Verified by bun run typecheck (clean) and bun run build (clean). Bundle confirms all six label strings still ship.
|
Follow-up commit
tsc + |
…ffortAriaLabel 12/12 reviewers flagged that the earlier think-aria-label helper was only wired into thread.tsx; the parallel reasoning-effort dropdown in shared-composer.tsx still hard-coded the raw "Reasoning effort: medium" label, so screen readers heard a stale effort value when the control was disabled (no model loaded, unsupported reasoning). Route shared-composer's effort button through the same helper, matching thread.tsx.
|
Follow-up All 12 reviewers independently flagged the same asymmetric-fix bug: Fix: route the shared composer effort button through the same helper: aria-label={thinkEffortAriaLabel({
modelLoaded,
reasoningDisabled,
reasoningEffort,
})}Also merged
|
Conflict in studio/frontend/src/features/chat/shared-composer.tsx: took main's helper-based aria-labels (thinkEffortAriaLabel / thinkToggleAriaLabel from unslothai#5655) since this branch never touched the Think pill — they were left at the pre-helper inline strings from before the divergence.
…slothai#5655) * studio/frontend: correct Think pill aria-label before model loads `reasoningEnabled` defaults to true in the chat-runtime store, so on a fresh /chat with no model the Think pill renders disabled + visually off (LightbulbOffIcon, data-active="false"), but its aria-label still reads "Disable thinking" -- screen readers announce it as if the button is currently on. Add a `disabled` branch between reasoningLockedOn and effectiveReasoningEnabled so the label reads "Thinking (model not loaded)" while the button is unreachable, then falls through to the normal enable/disable copy once a model is loaded. Apply the same fix to the equivalent pill in shared-composer (where the disabled flag is named `reasoningDisabled`). * studio/frontend: Think pill distinguishes !modelLoaded vs unsupported reasoning Address review feedback on unslothai#5655 (chatgpt-codex-connector + gemini-code-assist both flagged the same edge case): The previous `disabled` branch labeled the Think pill "Thinking (model not loaded)" whenever the button was disabled, but `disabled` is defined as `!(modelLoaded && effectiveSupportsReasoning)` (in thread.tsx) and `!modelLoaded || !effectiveSupportsReasoning` (in shared-composer.tsx). Both cover the second case where a model IS loaded but does not support reasoning at all (e.g. Llama-3.2-1B-Instruct), which mislabeled the pill for screen-reader users. Split the branch so the no-model case keeps "Thinking (model not loaded)" and the loaded-but-unsupported case reads "Thinking (not supported by this model)". Locked-on / enabled / disabled labels are unchanged. Verified by re-running the Playwright probe: - no model -> aria-label "Thinking (model not loaded)" - Llama-3.2-1B loaded -> aria-label "Thinking (not supported by this model)" - reasoning-capable loaded, OFF -> "Enable thinking" - reasoning-capable loaded, ON -> "Disable thinking" - locked-on model -> "Thinking is required for this model" * studio/frontend: extract Think pill aria-label helper, fix effort dropdown pre-load mislabel Address review consensus on unslothai#5655: 1. Extract the duplicate 5-branch aria-label conditional into a shared helper `thinkToggleAriaLabel` (plus a parallel `thinkEffortAriaLabel` for the reasoning-effort dropdown). Both `thread.tsx` and `shared-composer.tsx` now import from `components/assistant-ui/think-aria-label.ts`. 2. While reviewing the diff, an Opus reviewer noticed the same conceptual bug existed in the reasoning-effort dropdown branch in `thread.tsx:627` (the alternate render path used by Claude-style models with effort levels): before a model loaded, the aria-label announced e.g. "Reasoning effort: medium" on a disabled, grayed-out button. Same contradiction as the original bug for the on/off toggle. Now routed through `thinkEffortAriaLabel`, which falls back to "Thinking (model not loaded)" / "Thinking (not supported by this model)" while the button is unreachable and only emits the effort label when the model is loaded and actually supports reasoning. 3. Locked-on stays intentionally absent from `thinkEffortAriaLabel`: the dropdown remains interactive in that case (users can still pick an effort level), so the per-level label is the right announcement. Verified by bun run typecheck (clean) and bun run build (clean). Bundle confirms all six label strings still ship. * studio/frontend: route shared composer effort dropdown through thinkEffortAriaLabel 12/12 reviewers flagged that the earlier think-aria-label helper was only wired into thread.tsx; the parallel reasoning-effort dropdown in shared-composer.tsx still hard-coded the raw "Reasoning effort: medium" label, so screen readers heard a stale effort value when the control was disabled (no model loaded, unsupported reasoning). Route shared-composer's effort button through the same helper, matching thread.tsx. * studio/frontend: shorten think-aria-label helper comments --------- Co-authored-by: danielhanchen <[email protected]>
Summary
aria-labelreads "Disable thinking" before a model loads, even though the button isdisabledand visibly OFF (the LightbulbOffIcon variant is shown,data-active="false").reasoningEnableddefaults totruein the chat-runtime store (chat-runtime-store.ts:350,467), soeffectiveReasoningEnabledistrueon first paint -- and the aria-label falls through to theeffectiveReasoningEnabled ? "Disable thinking" : "Enable thinking"branch without considering thedisabled(model-not-loaded) gate above it.disabledbranch betweenreasoningLockedOnandeffectiveReasoningEnabledso the label reads "Thinking (model not loaded)" while the button is unreachable. Once the model is loaded, the existing enable/disable copy resumes. Same fix applied to the equivalent pill inshared-composer.tsx(where the disabled flag is namedreasoningDisabled).Test plan
supportsReasoningOffis false), verify the label stays "Thinking is required for this model".