[wp-trac] [WordPress Trac] #29988: Twenty Fifteen: Use JS/postMessage to update the color scheme instead of triggering a page refresh

WordPress Trac noreply at wordpress.org
Thu Oct 16 04:10:59 UTC 2014


#29988: Twenty Fifteen: Use JS/postMessage to update the color scheme instead of
triggering a page refresh
---------------------------+-------------------------
 Reporter:  avryl          |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  4.1
Component:  Bundled Theme  |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  javascript
---------------------------+-------------------------

Comment (by celloexpressions):

 We really shouldn't do that. The only good way to implement postMessage
 support here would be for core to support partial preview refreshes:
 #27355. Otherwise we have to have the colorscheme logic (mostly CSS)
 duplicated in JS, which makes it even harder to keep in sync with the
 stylesheet. The general rule of thumb for colorscheme-type options in the
 Customizer right now is that you have two options:
 - Use color pickers, generate css from that in the `<head>`, and use only
 `refresh` previewing.
 - Offer a pre-defined list of colorshemes (via a select or radio control),
 and trigger the different schemes with a body class, building the actual
 styles into a stylesheet that grabs one by class. Then, you can implement
 `postMessage` pretty cleanly by just changing that body class. This is
 also the best way to implement layout options such as left/right sidebar,
 and is the fastest way to live-preview leveraging browser capabilities.

 Twenty Fifteen does both UI-wise, which could work, although I don't think
 the UX is very good right now. I'll most likely be making a ticket to
 clean up the approach for the colorschemes more generally, as it has some
 major issues based on my initial quick look at it.

 But for this, unless we want to significantly change how the colorschemes
 work, getting #27355 patched and into core in 4.1 is probably our only
 option here. I had planned on doing it for 4.1, but it got pushed out of
 priority so that we could focus on things like media in the Customizer,
 since that was an advertised feature of Twenty Fifteen that we wanted to
 highlight with revamped background images and the removal of the old admin
 screens. We can probably make that happen only if we get some breathing
 room with beta on that ticket (ie, it probably needs a bit more than 2
 weeks).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29988#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list