kirki: typography field with transport postMessage not working as expected
Issue description:
When I use the typography field with transport postMessage, it doesn’t work as I would expect it. When selecting a font family, it will ALWAYS refresh the page. When I change any of the other typography sub fields, such as font size or color, nothing happens unless I change the font family, so that it refreshes, and only then are all the other changed options applied as well.
When I set the typography field to transport refresh, then the page refreshes on every single change on any sub field, which is as expected.
Version used:
Latest github version. Tested older versions from 2 months ago. Same issue
Using theme_mods or options?
theme_mods
Code to reproduce the issue (config + field(s))
Kirki::add_field( 'my_config', array(
'type' => 'typography',
'settings' => 'my_setting',
'label' => esc_attr__( 'Control Label', 'kirki' ),
'section' => 'my_section',
'transport' => 'postMessage',
'default' => array(
'font-family' => 'Roboto',
'variant' => 'regular',
'font-size' => '14px',
'line-height' => '1.5',
'letter-spacing' => '0',
'subsets' => array( 'latin-ext' ),
'color' => '#333333',
'text-transform' => 'none',
'text-align' => 'left'
),
'priority' => 10,
'output' => array(
array(
'element' => 'body',
),
),
) );
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 25 (6 by maintainers)
Commits related to this issue
- bugfix for #1186 — committed to themeum/kirki by aristath 7 years ago
Hmmm… So in your case you’re pre-loading a predefined array of fonts, correct? For obvious performance reasons we can’t do that for ALL google fonts, but that brings up another interesting question.
Have you tried if the webfontloader allows updating the fonts instantly without a delay? they use something like this:
So I’m assuming you’re changing the array of fonts there. If changed via JS to add/remove fonts instead of reloading the page, will the fonts live-update without soft-refreshing the page? If the answer is yes then we could implement that in Kirki…