#20896 closed enhancement (fixed)
Theme Customizer: Add "no-customize-support" class to the body tag by default
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Appearance | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | xoodrew@… |
Description
I just stumbled across this comment for wp_customize_support_script():
It is also recommended that you add the "no-customize-support" class to the body tag by default.
And I thought: Let's!
Attachments (4)
Change History (19)
comment:3
in reply to:
↑ 2
kobenland
— 12 months ago
Replying to scribu:
First of all, why? What does this patch fix?
In [20918] functionality was introduced to hide the 'Customize' link, when the customizer is not supported.
By adding 'no-customize-support' to the default body classes (when the admin bar is showing), we can be sure it is there and don't have to rely on Themes' best practice, we'd streamline behavior with the admin, where the class is also added by default and can shave off a bit from the JS.
comment:4
nacin
— 10 months ago
The reasoning behind removing the class was to specifically separate the loader from the admin. koopersmith probably remembers more.
comment:7
SergeyBiryukov
— 9 months ago
From #22052:
In order for hide-if-no-customize in the Toolbar to work, no-customize-support has to be added by default to the body classes. If there is Customize support, wp_customize_support_script() rewrites it to customize-support.
comment:8
DrewAPicture
— 9 months ago
- Cc xoodrew@… added
SergeyBiryukov
— 9 months ago
comment:9
SergeyBiryukov
— 9 months ago
In order for hide-if-no-customize in the Toolbar to work, no-customize-support has to be added by default to the body classes.
From my testing, this is exactly what wp_customize_support_script() does, on the front end as well. In IE 7, which doesn't support the customizer, the link in the Toolbar is not visible.
I guess the comment about adding no-customize-support class to the body tag by default is no longer relevant. 20896.3.diff removes it.
comment:10
follow-up:
↓ 11
nacin
— 9 months ago
- Keywords close added
Adding no-customize-support by default is to handle flashes of should-be-hidden content before the JS in wp_customize_support_script() fires. Otherwise, content that is both .hide-if-customize and .hide-if-no-customize might appear by default, among other side effects.
But, since "Customize" appears in a dropdown in the toolbar, and therefore hidden on load, we're not worried about a flicker, and can let the JS handle it.
comment:11
in reply to:
↑ 10
;
follow-up:
↓ 12
DrewAPicture
— 9 months ago
- Keywords close removed
Replying to nacin:
Adding no-customize-support by default is to handle flashes of should-be-hidden content before the JS in wp_customize_support_script() fires. Otherwise, content that is both .hide-if-customize and .hide-if-no-customize might appear by default, among other side effects.
But, since "Customize" appears in a dropdown in the toolbar, and therefore hidden on load, we're not worried about a flicker, and can let the JS handle it.
My intent is to allow for a graceful no-js fallback. no-js means no Customizer and it also means we can't rely on the JS to add the correct class for us. This is accounted for (unintentionally?) in the two other instances of Customizer links in the Dashboard because no-customize-support is added in admin-header.php. 20896.4.diff adds the body class for the front-end.
comment:12
in reply to:
↑ 11
koopersmith
— 9 months ago
- Keywords dev-feedback removed
Conceptually, this makes sense. The original patch (20896.diff) is solid.
Replying to DrewAPicture:
This is accounted for (unintentionally?) in the two other instances of Customizer links in the Dashboard...
It was intentional. Your reasoning is correct.
comment:13
nacin
— 9 months ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In [22107]:
comment:14
DrewAPicture
— 9 months ago
Related: #22103 - wp_customize_support_script() removes spaces separating classes
comment:15
SergeyBiryukov
— 8 months ago
- Milestone changed from Awaiting Review to 3.5
Add 'no-customize-support' class to the body tag by default