feat: polish settings custom background UI - #14
Conversation
irmia2026
left a comment
There was a problem hiding this comment.
Thanks for the PR! The canvas blur-crop approach is clever, and the performance optimizations (will-change/contain) are thoughtful. A few issues to address:
🔴 Important
1. Toast 与实际行为矛盾
handleCustomBackgroundUpload 第 318 行 toast:"深色/浅色/自动模式仍可切换"。但 cycleAppearanceMode 和 applyAppearance 都强制锁定 dark 模式,实际无法切换。建议改为:
showToast("自定义背景已启用(深色模式)");2. switchToPresetBackground 丢失用户的 appearance 偏好
自定义背景启用时 appearanceMode 被强制改为 "dark"。切回预设后 applyAppearance(appearanceMode) 永远传 "dark",用户之前的 "light" 或 "auto" 设置丢失。建议在启用自定义背景前保存原 appearanceMode(如 previousAppearanceMode),切回时恢复。
🟡 Minor
3. prefers-reduced-motion 太激进
当前 * { animation: none !important; transition: none !important; } 影响页面所有元素。建议限定为自定义背景模式下的卡片元素,避免波及其他 UI 组件。
4. refreshThemeControls 被三重调用
applyCustomBackground → applyPalette (内部调 refreshThemeControls) → applyAppearance (内部也调) → 末尾再手动调一次。功能正确但可精简。
✅ 做得好的
- Canvas 双层模糊裁切 + shadow 描边方案很漂亮
- 12MB 限制 +
CUSTOM_BACKGROUND_SIZE常量化 aria-pressed+focus-visible无障碍处理will-change/contain/translateZ性能优化到位button:disabled样式完善
irmia2026
left a comment
There was a problem hiding this comment.
@xiaokangzaina Thanks for the follow-up fix! Re-reviewing 4e68729:
#1 (Toast): Button now properly disabled with title "自定义背景下已锁定深色模式" and label showing "锁定". This correctly communicates that custom backgrounds intentionally lock dark mode — not a bug but a design decision. Toast copy could be updated to match, minor and not a blocker.
#2 (previousAppearanceMode): Now persisted both front-end and back-end. Looks correct.
#3 (reduced-motion): Still suggest scoping to custom-bg cards only — not blocking.
#4 (refreshThemeControls triple call): Now single-called from applyPalette. Clean.
No blockers. Approved.
Summary
Checks
syntax_check pages/settings/app.jspassed.