chatwoot/app/javascript/widget
Sivin Varghese 5de7ae492c
fix: html/body background not applied in appearance mode (#13955)
# Pull Request Template

## Description

This PR fixes the white background bleed visible in the widget, widget
article viewer and help center when dark mode is active.

**What was happening**

While scrolling, the `<body>` element retained a white background in
dark mode. This occurred because dark mode classes were only applied to
inner container elements, not the root.

**What changed**

* **Widget:** Updated the `useDarkMode` composable to sync the `dark`
class to `<html>` using `watchEffect`, allowing `<body>` to inherit dark
theme variables. Also added background styles to `html`, `body`, and
`#app` in `woot.scss`.
* **Help center portal:** Moved `bg-white dark:bg-slate-900` from
`<main>` to `<body>` in the portal layout so the entire page background
responds correctly to dark mode, including within the widget iframe.
* **ArticleViewer:** Replaced hardcoded `bg-white` with `bg-n-solid-1`
to ensure better theming.


Fixes
https://linear.app/chatwoot/issue/CW-6704/widget-body-colour-not-implemented

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

### Screencasts

### Before

**Widget**


https://github.com/user-attachments/assets/e0224ad1-81a6-440a-a824-e115fb806728

**Help center**


https://github.com/user-attachments/assets/40a8ded5-5360-474d-9ec5-fd23e037c845



### After

**Widget**


https://github.com/user-attachments/assets/dd37cc68-99fc-4d60-b2ae-cf41f9d4d38c

**Help center**


https://github.com/user-attachments/assets/bc998c4e-ef77-46fa-ac7f-4ea16d912ce3




## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2026-03-31 16:55:21 +05:30
..
api chore: Limit the number of articles retrieved by widget (#11095) 2025-03-15 14:10:12 -07:00
assets fix: html/body background not applied in appearance mode (#13955) 2026-03-31 16:55:21 +05:30
components fix: show agent name in unread bubble for Captain replies (#13876) 2026-03-23 20:03:31 +05:30
composables fix: html/body background not applied in appearance mode (#13955) 2026-03-31 16:55:21 +05:30
constants feat: widget opened and closed events (#11240) 2025-04-24 17:01:39 +05:30
helpers perf: reduce presence update frequency and fix background tab throttling (#13726) 2026-03-09 18:23:44 +05:30
i18n chore: Update translations (#13832) 2026-03-17 16:02:40 -07:00
mixins feat: Migrate availability mixins to composable and helper (#11596) 2025-08-22 00:43:34 +05:30
store fix: Prioritize SDK enableFileUpload flag when explicitly set (#13091) 2025-12-17 19:03:54 +05:30
views fix: html/body background not applied in appearance mode (#13955) 2026-03-31 16:55:21 +05:30
App.vue chore: Use widget color for chat input focus state (#13214) 2026-01-14 14:33:56 +05:30
router.js chore: Add cache to improve widget performance (#11163) 2025-03-24 16:04:49 -07:00