WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 2 months 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 9 months ago.
22030.1.2.diff (815 bytes) - added by obenland 9 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 SergeyBiryukov9 months ago

  • Component changed from General to Appearance

comment:2 DrewAPicture9 months ago

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

comment:3 lancewillett9 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 DrewAPicture9 months ago

  • Keywords close removed

Opened #22038 to discuss UX of default background colors.

comment:5 Ov3rfly9 months ago

  • 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. And about the theme functions.php file, if there is no add_theme_support() for custom-background, again no inline code required.

Last edited 9 months ago by Ov3rfly (previous) (diff)

comment:6 DrewAPicture9 months ago

Related: #22038 – Bad UX with default background color

comment:7 SergeyBiryukov9 months ago

  • Milestone set to Awaiting Review

comment:8 toscho9 months ago

  • Cc info@… added

obenland9 months ago

comment:9 obenland9 months ago

  • Keywords has-patch added

obenland9 months ago

comment:10 Ov3rfly9 months ago

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

Last edited 9 months ago by Ov3rfly (previous) (diff)

comment:11 SergeyBiryukov4 months ago

  • Milestone changed from Awaiting Review to 3.6

comment:12 lancewillett3 months ago

  • Keywords commit added

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

comment:13 nacin2 months 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?

Note: See TracTickets for help on using tickets.