Files
fusion/packages/dashboard/app/components/ChatQuestionResponse.css
gsxdsm 81fbb656ac FN-7613: fix confirm Yes/No button selected-state visibility
Fix confirm Yes/No selected-state visibility in chat questions and add aria-pressed accessibility support.

- Strengthen CSS specificity for .chat-question-response__confirm--selected so the selected style beats the global .btn/.btn:hover rules, using token-driven --cta-* colors for light/dark themes.
- Add dedicated hover and focus-visible states for the selected confirm button.
- Add aria-pressed to the Yes/No confirm buttons so assistive tech reflects the same selected state.
- Add regression tests covering the selected visual/aria state.
- Add changeset (patch) documenting the fix.

Files changed:
 .changeset/fn-7613-confirm-selected-state.md       |  7 ++++
 .../app/components/ChatQuestionResponse.css        | 40 ++++++++++++++++++++--
 .../app/components/ChatQuestionResponse.tsx        |  8 +++++
 .../__tests__/ChatQuestionResponse.test.tsx        | 26 ++++++++++++++
 4 files changed, 79 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-7613

Fusion-Task-Lineage: d648044e-ab30-4542-9402-a7bfbfe6563e

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-07-06 19:03:06 -07:00

231 lines
5.7 KiB
CSS

.chat-question-response {
display: flex;
flex-direction: column;
gap: var(--space-md);
margin-block: var(--space-sm);
padding: var(--space-md);
border: thin solid color-mix(in srgb, var(--accent) 28%, var(--border));
border-radius: var(--radius-lg);
background: color-mix(in srgb, var(--accent) 6%, var(--bg-secondary));
color: var(--text);
}
.chat-question-response--compact {
gap: var(--space-sm);
padding: var(--space-sm);
border-radius: var(--radius-md);
}
.chat-question-response__header,
.chat-question-response__actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-sm);
}
.chat-question-response__eyebrow,
.chat-question-response__answered-label,
.chat-question-response__submitted-label {
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--text-muted);
}
.chat-question-response__answered-label {
color: var(--color-success);
}
.chat-question-response__questions {
display: flex;
flex-direction: column;
gap: var(--space-md);
}
.chat-question-response__question {
display: flex;
flex-direction: column;
gap: var(--space-xs);
}
.chat-question-response__question-header {
margin: 0;
font-size: 0.875rem;
font-weight: 600;
color: var(--text-muted);
}
.chat-question-response__question-text {
margin: 0;
font-size: 1rem;
line-height: 1.3;
color: var(--text);
}
.chat-question-response--compact .chat-question-response__question-text {
font-size: 0.875rem;
}
.chat-question-response__description,
.chat-question-response__hint {
margin: 0;
font-size: 0.875rem;
line-height: 1.45;
color: var(--text-muted);
}
.chat-question-response__options,
.chat-question-response__confirm-group {
display: flex;
flex-direction: column;
gap: var(--space-xs);
margin-block-start: var(--space-xs);
}
.chat-question-response__confirm-group {
flex-direction: row;
flex-wrap: wrap;
}
.chat-question-response__option {
display: flex;
align-items: flex-start;
gap: var(--space-sm);
padding: var(--space-sm);
border: thin solid var(--border);
border-radius: var(--radius-md);
background: var(--card);
cursor: pointer;
transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}
.chat-question-response__option:hover,
.chat-question-response__option--selected {
border-color: var(--accent);
background: color-mix(in srgb, var(--accent) 12%, var(--card));
}
/*
FNXC:ChatQuestionResponse 2026-07-05-00:00:
The confirm Yes/No buttons also carry the global `.btn` class, whose base
background and (especially) `.btn:hover` rule (specificity 0,2,0) visually
swamped the old single-class `.chat-question-response__confirm--selected`
rule (0,1,0), so a clicked answer never looked selected. Use a compound
selector (`.chat-question-response__confirm.chat-question-response__confirm--selected`,
specificity 0,2,0) plus a dedicated `:hover` override so the selected state
beats `.btn`/`.btn:hover` in every interaction state, and keep everything
token-driven (`--cta-*` / `--accent` via color-mix) so light/dark themes and
the mobile column layout stay correct without hardcoded colors.
*/
.chat-question-response__confirm {
border-color: var(--border);
background: var(--card);
color: var(--text);
font-weight: 500;
}
.chat-question-response__confirm.chat-question-response__confirm--selected {
border-color: var(--cta-border);
background: color-mix(in srgb, var(--cta-bg) 55%, var(--card));
color: var(--cta-text);
font-weight: 700;
box-shadow: var(--cta-glow), inset 0 0 0 var(--btn-border-width) var(--cta-border);
}
.chat-question-response__confirm.chat-question-response__confirm--selected:hover {
background: color-mix(in srgb, var(--cta-bg-hover) 60%, var(--card));
border-color: var(--cta-border-hover);
color: var(--cta-text);
}
.chat-question-response__confirm.chat-question-response__confirm--selected:focus-visible {
box-shadow: var(--focus-ring-strong), var(--cta-glow);
}
.chat-question-response__option input {
margin: calc(var(--space-xs) / 2) 0 0;
accent-color: var(--accent);
}
.chat-question-response__option-content {
display: flex;
flex-direction: column;
gap: calc(var(--space-xs) / 2);
min-width: 0;
}
.chat-question-response__option-label {
font-size: 0.875rem;
font-weight: 600;
color: var(--text);
}
.chat-question-response__option-description {
font-size: 0.875rem;
line-height: 1.45;
color: var(--text-muted);
}
.chat-question-response__textarea {
width: 100%;
min-height: calc(var(--space-xl) * 3);
margin-block-start: var(--space-xs);
resize: vertical;
line-height: 1.45;
}
.chat-question-response__submit {
flex: 0 0 auto;
}
.chat-question-response__submitted {
display: flex;
flex-direction: column;
gap: var(--space-xs);
padding: var(--space-sm);
border: thin solid var(--border);
border-radius: var(--radius-md);
background: var(--card);
}
.chat-question-response__submitted pre {
margin: 0;
white-space: pre-wrap;
font-family: var(--font-mono);
font-size: 0.875rem;
line-height: 1.45;
color: var(--text);
}
.chat-question-response--compact .chat-question-response__actions {
align-items: stretch;
flex-direction: column;
}
.chat-question-response--compact .chat-question-response__submit {
width: 100%;
}
@media (max-width: 768px) {
.chat-question-response {
padding: var(--space-sm);
border-radius: var(--radius-md);
}
.chat-question-response__header,
.chat-question-response__actions {
align-items: stretch;
flex-direction: column;
}
.chat-question-response__confirm-group {
flex-direction: column;
}
.chat-question-response__submit {
width: 100%;
}
}