Opened 8 months ago
Last modified 4 weeks ago
#22030 reopened defect (bug)
After "clear background-color" in design options, still css is added to html-output
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.6 |
| Component: | Appearance | Version: | 3.4.2 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | xoodrew@…, info@… |
Description
After you select "clear background-color" in design options, the default color still is added as inline css to html-output of frontend.
Tested with 3.4.2 and Twenty Twelve 1.0 theme
Steps to reproduce:
- Look at default html-output, no inline css for background-color
- Design -> Background -> Color, select e.g. color #123456, save
- Look at html-output, this is added:
<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #123456; }
</style>
- Design -> Background -> Color -> Click "clear" option, save
- Look at html-output, this is added with default value:
<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #e6e6e6; }
</style>
Expected behaviour: After "clear" option is used and default value #e6e6e6 (or only a #) is shown in backend, no inline css should be included in html output of frontend.
Attachments (2)
Change History (15)
comment:1
SergeyBiryukov — 8 months ago
- Component changed from General to Appearance
comment:2
DrewAPicture — 8 months ago
- Cc xoodrew@… added
- Keywords close added
comment:3
lancewillett — 8 months ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
Yes, this is intentional with Twenty Twelve. WP now allows you to set a default background color in the theme functions file. When you "clear the color" in Appearance > Background it should revert back to the default color value.
comment:4
DrewAPicture — 8 months ago
- Keywords close removed
Opened #22038 to discuss UX of default background colors.
- Resolution wontfix deleted
- Status changed from closed to reopened
In a new wordpress install, where no value has been set for custom background-color via backend yet, no inline css is added to front end html, as expected.
After a value for custom background-color has been saved, the inline css appears, as expected.
But (and that's the bug here) it does not disappear again (as it should), if the value is "cleared" via the backend "clear" option.
The currently only way to remove that inline css again, is to delete the entry theme_mods_twentytwelve in database wp_options table.
Expected behaviour: No/empty/cleared setting = no extra inline css.
Note: The default background color comes from style.css, no inline code required.
comment:6
DrewAPicture — 8 months ago
Related: #22038 – Bad UX with default background color
comment:7
SergeyBiryukov — 8 months ago
- Milestone set to Awaiting Review
comment:10
Ov3rfly — 8 months ago
Tested 22030.1.2 with 3.4.2, works exactly as expected. Thanks.
comment:11
SergeyBiryukov — 3 months ago
- Milestone changed from Awaiting Review to 3.6
comment:12
lancewillett — 8 weeks ago
- Keywords commit added
22030.1.2 patch looks good, let's get this in.
comment:13
nacin — 4 weeks ago
Related code here has a lot of history. See [21054] and all of the tickets it links to. This does not regress any of those issues, correct?

I believe this is intentional as #e6e6e6 is the default background color for Twenty Twelve. See #21226.
Suggest close.