Skip to content

Commit e10219b

Browse files
fix(feedback-widget): dark-mode adaptation + clearer placeholder (#7282)
## Summary - FeedbackWidget surfaces (main FAB, mini-FAB stack, "Thanks!" toast, popover Paper + TextFields + toggle buttons + secondary text) now use CSS theme tokens (`--bg-surface`, `--bg-elevated`, `--ink`, `--ink-muted`, `--rule`) instead of MUI palette tokens, so they track the active light/dark scheme. - Placeholder copy changed from "Typo, weird chart, feature idea…" to "Bug, idea, typo, anything…" — bugs are a reactable category (🪲 already in the toggles) and the new wording reads less dismissive. ## Context MUI's palette is hard-pinned to `mode: 'light'` in `app/src/main.tsx`; dark mode runs only through CSS custom properties on `<html>`. Components using MUI tokens like `background.default`, `text.primary`, `background.paper`, `text.secondary`, `action.hover` therefore stay cream-on-dark when the user enables dark mode. The FeedbackWidget was such a component. The structural cure (migrating the theme to `CssVarsProvider` with both `colorSchemes`) is tracked separately in #7281. This PR is the local fix for the widget so users on dark mode aren't blocked by the refactor. ## Verified - Typecheck (`tsc --noEmit`) green - Light mode: FAB + popover render unchanged from before - Dark mode (Playwright + computed-style probe): - `.MuiPopover-paper` → `rgb(36,36,32)` text `rgb(240,239,232)` - FAB → `rgb(26,26,23)` icon `primary.main` - Placeholder + secondary text use `--ink-muted` - Toggle button border and selected state use `--rule` / `--bg-surface` ## Test plan - [ ] Open `/` in light mode → click feedback FAB → expand → all four reactions visible, placeholder reads "Bug, idea, typo, anything…" - [ ] Switch to dark mode → FAB + quick stack appear as warm near-black on dark page (not cream) - [ ] Open detailed popover in dark → Paper, input border, placeholder, toggle buttons, "Page:" footer all read on dark surface - [ ] Submit a 👍 → "Thanks!" toast appears on the elevated surface (not white) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 780a2e2 commit e10219b

1 file changed

Lines changed: 40 additions & 12 deletions

File tree

app/src/components/FeedbackWidget.tsx

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const THANKS_TIMEOUT_MS = 1200;
2828
const miniFabSx = {
2929
width: 40,
3030
height: 40,
31-
bgcolor: 'background.default',
32-
color: 'text.primary',
31+
bgcolor: 'var(--bg-surface)',
32+
color: 'var(--ink)',
3333
opacity: 0.85,
34-
'&:hover, &:focus-visible': { opacity: 1, bgcolor: 'action.hover' },
34+
'&:hover, &:focus-visible': { opacity: 1, bgcolor: 'var(--bg-elevated)' },
3535
} as const;
3636

3737
const REACTIONS = [
@@ -288,12 +288,12 @@ export function FeedbackWidget() {
288288
width: { xs: 40, sm: 48 },
289289
height: { xs: 40, sm: 48 },
290290
minHeight: { xs: 40, sm: 48 },
291-
bgcolor: 'background.default',
291+
bgcolor: 'var(--bg-surface)',
292292
color: 'primary.main',
293293
opacity: { xs: 0.75, sm: 0.85 },
294294
transform: liftTransform,
295295
transition: 'transform 120ms ease-out',
296-
'&:hover, &:focus-visible': { opacity: 1, bgcolor: 'action.hover' },
296+
'&:hover, &:focus-visible': { opacity: 1, bgcolor: 'var(--bg-elevated)' },
297297
}}
298298
>
299299
<ForumIcon />
@@ -361,9 +361,9 @@ export function FeedbackWidget() {
361361
position: 'fixed',
362362
right: { xs: 60, sm: 76 },
363363
bottom: { xs: 16, sm: 22 },
364-
bgcolor: 'background.paper',
364+
bgcolor: 'var(--bg-elevated)',
365365
transform: liftTransform,
366-
color: 'text.primary',
366+
color: 'var(--ink)',
367367
px: 1.5,
368368
py: 0.5,
369369
borderRadius: 1,
@@ -384,13 +384,41 @@ export function FeedbackWidget() {
384384
onClose={handleClose}
385385
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
386386
transformOrigin={{ vertical: 'bottom', horizontal: 'right' }}
387-
slotProps={{ paper: { sx: { width: { xs: 'calc(100vw - 12px)', sm: 360 }, maxWidth: 400, p: 1.5 } } }}
387+
slotProps={{
388+
paper: {
389+
sx: {
390+
width: { xs: 'calc(100vw - 12px)', sm: 360 },
391+
maxWidth: 400,
392+
p: 1.5,
393+
bgcolor: 'var(--bg-elevated)',
394+
color: 'var(--ink)',
395+
'& .MuiOutlinedInput-root': {
396+
color: 'var(--ink)',
397+
'& fieldset': { borderColor: 'var(--rule)' },
398+
'&:hover fieldset': { borderColor: 'var(--ink-muted)' },
399+
'&.Mui-focused fieldset': { borderColor: 'primary.main' },
400+
},
401+
'& .MuiOutlinedInput-input::placeholder': {
402+
color: 'var(--ink-muted)',
403+
opacity: 1,
404+
},
405+
'& .MuiToggleButton-root': {
406+
color: 'var(--ink)',
407+
borderColor: 'var(--rule)',
408+
'&.Mui-selected': {
409+
bgcolor: 'var(--bg-surface)',
410+
'&:hover': { bgcolor: 'var(--bg-surface)' },
411+
},
412+
},
413+
},
414+
},
415+
}}
388416
>
389417
{submitted ? (
390418
<Box sx={{ py: 3, textAlign: 'center' }} role="status" aria-live="polite">
391419
<Box sx={{ fontSize: 28, mb: 1 }}>🙏</Box>
392420
<Box sx={{ fontWeight: 600 }}>Thanks!</Box>
393-
<Box sx={{ fontSize: 13, color: 'text.secondary', mt: 0.5 }}>
421+
<Box sx={{ fontSize: 13, color: 'var(--ink-muted)', mt: 0.5 }}>
394422
We read every note.
395423
</Box>
396424
</Box>
@@ -409,7 +437,7 @@ export function FeedbackWidget() {
409437
minRows={3}
410438
maxRows={6}
411439
fullWidth
412-
placeholder="Typo, weird chart, feature idea…"
440+
placeholder="Bug, idea, typo, anything…"
413441
value={message}
414442
onChange={(e) => setMessage(e.target.value)}
415443
slotProps={{ htmlInput: { maxLength: MAX_MESSAGE_LENGTH, 'aria-label': 'Feedback message' } }}
@@ -446,7 +474,7 @@ export function FeedbackWidget() {
446474
<Box
447475
sx={{
448476
fontSize: 11,
449-
color: 'text.secondary',
477+
color: 'var(--ink-muted)',
450478
mb: 1.5,
451479
whiteSpace: 'nowrap',
452480
overflow: 'hidden',
@@ -476,7 +504,7 @@ export function FeedbackWidget() {
476504
)}
477505

478506
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
479-
<Box sx={{ fontSize: 12, color: 'text.secondary' }}>
507+
<Box sx={{ fontSize: 12, color: 'var(--ink-muted)' }}>
480508
{message.length}/{MAX_MESSAGE_LENGTH}
481509
</Box>
482510
<Button

0 commit comments

Comments
 (0)