Repository navigation
Preserve the saved font on standalone submit buttons - #3792
Crabcyborg wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Dec 1, 2026 7:49p.m. | Review ↗ | |
| JavaScript | Dec 1, 2026 7:49p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Approve. The fix works and nothing blocks. One non-blocking note: no test covers the new variable.
Reproduced before and after in the preview env (Lite at fa6c917e1 vs. the same checkout with master's css/_single_theme.css.php). The style has font "Georgia", serif, no custom submit style, and the page sets :root{--font:"Courier New",monospace} like a theme would. One styled form plus a standalone <button class="frm_form_submit_style">:
| in-form Submit | standalone button | |
|---|---|---|
| master template | Georgia, serif | "Courier New", monospace (the bug) |
| this PR | Georgia, serif | Georgia, serif |
Before (the Standalone button is monospace, the in-form Submit is Georgia):

Also checked:
- Live font change in the styler:
.frm_style_x.with_frm_style{--font:monospace}(the selectorrenderLiveVarswrites) moves the in-form button to monospace, and the standalone button stays Georgia. This matches the PR description. I injected the rule by hand, so the styler UI itself was not driven. --frm-submit-font-familyis declared on the same element that receives the live--font, so it recomputes with it.- A custom submit style (
submit_style=1) skips the whole submit block, so the variable is not declared. This is the same as master, not a regression. - Empty font (the default) skips both the declaration and the
font-familyline, as before. - Searched the repo for other
font-family:var(--font,fallbacks on a button rule: none. The othervar(--font)uses are unscoped inputs and labels inside the wrapper, which is correct.
Non-blocking: add a regression test. The fix has no test, and test_submit_button_rule_uses_css_vars in tests/phpunit/styles/test_FrmStylesHelper.php already covers the sibling properties of this rule. I ran this one in the harness: it passes on this branch (test_FrmStylesHelper 14 tests / 241 assertions OK) and fails against master's template.
public function test_submit_font_uses_scoped_var() {
$frm_style = new FrmStyle();
$post_content = $frm_style->get_defaults();
$post_content['font'] = 'Georgia, serif';
$post_content['submit_style'] = 0;
$_POST = array(
'action' => 'frm_change_styling',
'style_name' => 'frm_style_test',
'frm_style_setting' => array( 'post_content' => $post_content ),
);
$style = '';
$defaults = array();
ob_start();
include FrmAppHelper::plugin_path() . '/css/_single_theme.css.php';
$css = ob_get_clean();
$this->assertSame( 1, preg_match( '/\.frm_form_submit_style\s*\{([^}]*)\}/', $css, $matches ) );
$rule = preg_replace( '/\s+/', '', $matches[1] );
$this->assertStringContainsString( 'font-family:var(--frm-submit-font-family,Georgia,serif)', $rule );
$this->assertStringContainsString( '--frm-submit-font-family:var(--font);', preg_replace( '/\s+/', '', $css ) );
}Not covered: the styler UI itself, and any theme besides the injected :root variable. CI's PHPUnit job was skipped on this PR, so the harness run above is the only PHPUnit result for it.

Follow-up to #3782.
A theme that sets a global
--fontcan override the saved font on a standalone.frm_form_submit_stylebutton. The shared submit rule now reads a Formidable-specific variable defined on the style wrapper. Buttons within the wrapper follow live font changes. Standalone buttons use the saved font stack.Verified the cascade in an isolated Chrome fixture with a conflicting root font. Both buttons initially used Georgia. Updating the wrapper font to monospace changed only the wrapped button. The WordPress Styler UI was not exercised.
Scoped Psalm reported 18 errors on both the base and the changed template.
Summary by CodeRabbit