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: Ov3rfly 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:

  1. Look at default html-output, no inline css for background-color
  2. Design -> Background -> Color, select e.g. color #123456, save
  3. Look at html-output, this is added:
<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #123456; }
</style>
  1. Design -> Background -> Color -> Click "clear" option, save
  2. 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)

22030.diff (734 bytes) - added by obenland 8 months ago.
22030.1.2.diff (815 bytes) - added by obenland 8 months ago.

Download all attachments as: .zip

Change History (15)

  • Component changed from General to Appearance
  • Cc xoodrew@… added
  • Keywords close added

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

Suggest close.

  • 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.

  • 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.

Version 1, edited 8 months ago by Ov3rfly (previous) (next) (diff)

Related: #22038 – Bad UX with default background color

  • Milestone set to Awaiting Review
  • Cc info@… added
  • Keywords has-patch added

Tested 22030.1.2 with 3.4.2, works exactly as expected. Thanks.

Last edited 8 months ago by Ov3rfly (previous) (diff)
  • Milestone changed from Awaiting Review to 3.6
  • Keywords commit added

22030.1.2 patch looks good, let's get this in.

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?

Note: See TracTickets for help on using tickets.