You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix inline Submit button sitting below the inputs with frm_flex submit HTML - #3613
With Submit Button Position set to Inline and top labels, the Submit button sat 17px below the inputs when the form used the default submit HTML (<div class="frm_submit frm_flex">). Forms with the old <div class="frm_submit"> lined up fine.
The hidden ::before spacer is a flex item in the wrapping frm_flex row, so it no longer sits above the button. align-items: center then centers the button against the spacer.
What changed
css/custom_theme.css.php: for an inline submit that uses frm_flex, the spacer takes a full row and the items start at the top with no row gap. order: -2 keeps the spacer first when Pro puts Previous (order: -1) in the same row.
classes/helpers/FrmFormsHelper.php: the inline-top class now follows the label position of the input closest to the submit button, and adds frm_inline_inside when that label is inside, so the spacer can match the inside-label padding instead of a label height.
Known limit: the spacer copies the label metrics from the form style. If a theme (Astra and Hello Biz were reported) restyles .frm_primary_label with its own font size, line height or padding, the spacer no longer matches the real label and the button can sit a few pixels low. CSS alone can't see the theme's values.
How it was verified
Lite + Pro in a local preview env, forms with two frm4 fields and the inline submit. Button top minus input top:
before
after
default HTML, 1400px
17.05px
0px
default HTML, 700px
17.05px
0px
old HTML (frm_submit)
0px
0px
Before:
After:
Multi-page form, page 2 (Previous + Submit), top offset from the input top. Before: Previous -26px, Submit 37.8px. After: Previous 0px, Submit 34px. They stack because the cell is narrow; that is the same before and after.
PHPUnit: test_get_form_style_class_adds_inline_inside_class_for_inside_labels (test_FrmFormsHelper.php) covers the submit-area classes, and test_generated_css_aligns_inline_flex_submit_with_inputs (test_FrmStyle.php) covers the generated CSS rules. Neither can check the rendered position: frm_flex only becomes a flex row with Pro active, and Lite's CI has no Pro.
The ::before spacer was a flex item in the wrapping row and the button was
centered against it. Make the spacer a full row and pin items to the top.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
We reviewed changes in af2332f...b113e4a on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.
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.
The reason will be displayed to describe this comment to others. Learn more.
Approving. The fix works and I reproduced it live. One small non-blocking note on row-gap: 0, inline below.
Repro (Lite master vs. this PR, Pro active, two frm4 fields, top labels, inline submit, default frm_submit frm_flex HTML): button top minus input top was 17.05px on master and is 0px on this branch. At 1400px and 700px wide. The old frm_submit markup stays at ~0px both before and after. Computed styles on the branch: spacer flex-basis: 100%, order: -2; wrapper align-items: flex-start, row-gap: 0.
After, single page:
After, multi-page form page 2 (Previous top 0px, Submit 34px; they stack because the cell is narrow, same as before the PR):
Not exercised: the second selector (frm_inline_submit in the submit HTML without frm_inline_top), and non-default Style settings. Checked by reading it, not rendering it. Psalm is red, but master's last two runs are red too (stripe/ files, nothing in this diff).
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking. row-gap: 0 also removes the ~1.9px gap that used to separate Previous and Submit when they wrap onto two rows. On page 2 of a multi-page form I measured the stacked buttons as 0px apart after this PR (the screenshot above shows them touching). The 0 is needed to keep the spacer from pushing the buttons down, so if you want the separation back, put it on the buttons instead, for example a small margin-bottom on .frm_prev_page inside this selector scope. Fine to leave if you'd rather not touch it.
The reason will be displayed to describe this comment to others. Learn more.
Leaving it. A margin-bottom on the Previous button would also grow the row in the common side-by-side layout, and the 2px only showed up when the buttons wrap, which is the narrow-cell case that stacked before too.
Agreed, leaving row-gap: 0 as is. The 2px only appears when the buttons wrap in a narrow cell, which already stacked before this PR, and a margin on Previous would grow the common side-by-side row. My Approve at df6754b stands.
Added a PHPUnit test, test_FrmStyle::test_generated_css_aligns_inline_flex_submit_with_inputs (commit e404c85). The layout itself needs Pro to render, but the generated stylesheet does not: the test renders custom_theme.css.php through FrmStyle::get_css_content() and asserts the inline frm_flex submit row gets align-items: flex-start and the ::before spacer gets flex-basis: 100%; order: -2. It fails against master CSS and passes on this branch.
Also merged master. test_FrmStyle passes (29 tests) and phpcs (Lite ruleset) is clean.
The spacer above an inline submit button copies the label size from the
form style. Themes like Hello Elementor and Hello Biz set
label { line-height: 1 }, which the spacer never sees, so the button sat
a few pixels off the inputs.
formidable.js now measures the gap between the top row of buttons and the
input closest to the submit button, then stores it in
--frm-inline-submit-offset. The CSS applies it as a margin on the spacer.
Without JS, or when the fields stack on narrow screens, the CSS spacer
works as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Approve at 8612c02. Since my Approve at 64497ad the PR gained master merges and one real commit, 8612c0207 ("Line up inline submit button when a theme restyles labels"): a small measure-and-correct step in formidable.js plus one CSS rule. I re-read the whole PR at this head (6 files, +242/-60, 0 behind master).
The change.alignInlineSubmitButtons() measures the top of the input in the button's row against the top of the button row and writes the difference to --frm-inline-submit-offset on .frm_submit. The new rule in custom_theme.css.php applies it as margin-bottom on the spacer ::before and is written to outrank the per-style spacer margin. Offsets under 0.5px are dropped, the property is cleared before each measurement, and it re-runs on load, resize, document.fonts.ready and frmPageChanged, coalesced through one requestAnimationFrame. When the closest field wraps onto its own row (narrow screens) there is no input to line up with, so no offset is set.
formidable.min.js carries the same code as formidable.js (both contain the offset logic, same 2 matches).
The rest of the diff against 64497ad is master (recaptcha handling, frm_ajax_load_form_builder filter) arriving through the merges; the PR's own FrmFormsHelper change (get_last_input_label_position() returning top/inside/hidden and adding frm_inline_inside) is unchanged.
Tests run at 8612c02 (wordpress-develop harness, PHP 8.4, PR tree in the Lite plugin, restored after; CI skipped PHPUnit on this PR): test_FrmFormsHelper OK (22 tests, 83 assertions), test_FrmStyle OK (14 tests, 89). With master's FrmFormsHelper.php and custom_theme.css.php swapped in, test_get_form_style_class_adds_inline_inside_class_for_inside_labels and test_generated_css_aligns_inline_flex_submit_with_inputs each fail, so both new tests catch the change.
Live check (preview env, Lite at 8612c02, Pro, a form with two top-label fields and submit_align inline, a page with the shortcode; a one-line stylesheet standing in for a theme that restyles label). Button top minus input top, settled after load:
theme label rule
label height
offset set
button minus input
none
21px
none
0
line-height: 1
15px
-6px
0
line-height: 2
30px
9px
0 (also at a 700px viewport)
With the property removed again on the line-height: 2 page (what the page looked like before this commit) the button sits 9px above the input; with it, level:
Before (offset removed):
After (as the PR renders):
Not run / not exercised: master's own JS side by side. The env's Pro loads its combined frm.min.js, which already carried this PR's front-end code, so the "before" picture is the PR page with the JS-set property removed, not a master run. Also not exercised: inside and hidden label positions at this head (my 11-03 run covered them for the earlier CSS), a form inserted after page load (popup or builder preview, where only resize/load would re-align), a multi-page form's Previous/Submit wrap, PHPCS/PHPStan/ESLint, and the review skills (the delta is one small commit). DeepSource PHP is red; I did not open it this round.
Replace the ::before spacer that copied the label size with
align-self: end on the inline submit cell, so the button lines up
with the bottom of the inputs in its row. Themes that restyle labels
no longer throw it off, so the JS measuring step and the
frm_inline_inside class are no longer needed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Variable $style_class might not be defined
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.
The reason will be displayed to describe this comment to others. Learn more.
Variable $style_class might not be defined
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.
The reason will be displayed to describe this comment to others. Learn more.
Request changes. The CSS-only approach fixes the theme-label case, but it drops the Submit button a full line below the inputs whenever a field in the row has a description or a validation error. Master does not do that.
Blocking: align-self: end aligns to the field box, not the input. Live in the Lite preview env (PR head cb2638619 vs origin/master, Pro at 6bc54c7a4, CSS regenerated for each, 1400px wide, inline Submit, two top-label fields). Button bottom minus input bottom:
Case
master
PR
plain fields
+4.3px (~4px low)
0px
email field with a description under the input
+4.3px
+16.8px
required fields after a blank submit (inline error under each input)
+4.3px
+16.8px
On the PR the button's bottom edge lines up with the bottom of the description or error text, so the button hangs below the input row by one text line (screenshots of both heads taken, master button level with the inputs, PR button visibly below). The blank-submit case hits every inline form with a required field on its first failed submit, so this is not an edge case. The PR's own test only asserts the selector string, so it cannot see this.
Possible directions: keep top alignment with a spacer that does not depend on the theme's label styles (the earlier commits did this), or reserve the description/error height so the bottom edge is the input's. Your call, but the fix needs a description and an error case in the check.
Tests run at cb2638619:
tests/phpunit/styles (--filter test_FrmStyle, wordpress-develop harness, PHP 8.4): 38 tests, 398 assertions, 1 failure: test_FrmStylesController::test_front_head (an unbuilt WP block-library asset notice; fails the same on base, not this PR). New test_generated_css_aligns_inline_submit_with_inputs passes, and fails with master's css/custom_theme.css.php.
CI skipped PHPUnit on this head.
Not exercised: the real original scenario with a theme that restyles labels (not re-run this round; the theme-independence follows from bottom alignment and the plain case measured 0px), 390px, multi-page Previous/Submit, label-inside and label-hidden layouts. The env's Pro frm.min.js bundle may still carry the earlier front JS offset correction, which I did not rule out; the master/PR difference above is CSS-only, but the absolute px values could include it. Review skills not run; I read the whole 3-file diff by hand.
The reason will be displayed to describe this comment to others. Learn more.
Expected 'this' to be used by class method 'observe'
If a class method does not use this, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
The reason will be displayed to describe this comment to others. Learn more.
Expected 'this' to be used by class method 'unobserve'
If a class method does not use this, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
The reason will be displayed to describe this comment to others. Learn more.
Expected 'this' to be used by class method 'observe'
If a class method does not use this, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'observe'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
The reason will be displayed to describe this comment to others. Learn more.
Variable $style might not be defined
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.
The reason will be displayed to describe this comment to others. Learn more.
Approve on b6bca1d, with one non-blocking note. Re-review of the whole PR (8 files, +335/-29). My Request Changes at cb26386 is resolved: the new commit b6bca1d ("align inline submit with inputs") goes back to aligning the button's top edge with the input and measures the offset in JS. The button no longer hangs below the row when a field has a description or an error.
Live, master vs PR (preview env, Lite at cbed427 (master) and at b6bca1d, Pro, 1400px wide, inline Submit, two top-label fields). The numbers are button top minus input top; the form with errors was measured after a blank submit:
Case
master
PR
plain fields
-1.9px
0
email field with a description
+6.5px
0
required fields, inline errors showing
+6.5px
0
theme rule label { line-height: 2 }, plain fields
-6.4px
0 (offset 9px)
theme rule label { line-height: 1 }, plain fields
not run
0 (offset -6px)
theme rule line-height: 2, 700px viewport
not run
0
Bottom edges on the PR are all -2.2px (the button is shorter than the input), so nothing hangs below any row. Errors case, master (button low) then PR (level):
Theme line-height: 2 label, master then PR:
The env's frm.min.js is a combined bundle, so I replaced its Lite block with each head's own formidable.min.js for these runs (master's for the master column) and regenerated the style CSS each time. Then I restored everything.
Tests run at b6bca1d (CI shows PHPUnit, the JS unit job and the other checks as skipping, so these are the only runs):
node --test tests/js/inlineSubmitAlignment.test.mjs → 8/8 pass (the harness needs @babel/core; I linked Lite's node_modules).
PHPUnit test_FrmStyle and test_FrmFormsHelper (wordpress-develop harness, PHP 8.4) → OK (21 tests, 78 assertions).
NODE_ENV=production npx webpack: the rebuilt js/formidable.min.js is byte-identical to the committed one.
Note, non-blocking:initInlineSubmitAlignment() puts a MutationObserver on the whole document.body (childList, subtree). Every DOM change anywhere on the page runs observeFields(), which loops the observed set, runs a querySelectorAll and schedules a frame. On a page with no inline form that is cheap, but a page with an animated widget (a ticker, a chat bubble) pays it constantly. Observing only the form containers, or skipping the work when .frm_inline_form is absent, would limit it. I did not measure it.
Not run / not exercised: mutation checks on the new JS tests (they use mock elements, so only the live run above shows real layout); 390px; label-inside and label-hidden layouts at this head; a multi-page form's Previous/Submit wrap; a form added after page load (popup, builder preview); a real Astra or Hello Biz theme (the label rule was injected by hand); PHPCS/ESLint/oxlint on the eslint.config.mjs/.oxlintrc.json edits; code-review/security-review/simplify (I read the whole diff by hand instead). DeepSource's PHP check is red; I did not open its findings. Garret's original theme report is covered only by the injected label rule, so he may want to confirm on Astra.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Strategy11/formidable-pro#6894
What was broken
With Submit Button Position set to Inline and top labels, the Submit button sat 17px below the inputs when the form used the default submit HTML (
<div class="frm_submit frm_flex">). Forms with the old<div class="frm_submit">lined up fine.The hidden
::beforespacer is a flex item in the wrappingfrm_flexrow, so it no longer sits above the button.align-items: centerthen centers the button against the spacer.What changed
css/custom_theme.css.php: for an inline submit that usesfrm_flex, the spacer takes a full row and the items start at the top with no row gap.order: -2keeps the spacer first when Pro puts Previous (order: -1) in the same row.classes/helpers/FrmFormsHelper.php: the inline-top class now follows the label position of the input closest to the submit button, and addsfrm_inline_insidewhen that label is inside, so the spacer can match the inside-label padding instead of a label height.Known limit: the spacer copies the label metrics from the form style. If a theme (Astra and Hello Biz were reported) restyles
.frm_primary_labelwith its own font size, line height or padding, the spacer no longer matches the real label and the button can sit a few pixels low. CSS alone can't see the theme's values.How it was verified
Lite + Pro in a local preview env, forms with two
frm4fields and the inline submit. Button top minus input top:frm_submit)Before:
After:
Multi-page form, page 2 (Previous + Submit), top offset from the input top. Before: Previous -26px, Submit 37.8px. After: Previous 0px, Submit 34px. They stack because the cell is narrow; that is the same before and after.
PHPUnit:
test_get_form_style_class_adds_inline_inside_class_for_inside_labels(test_FrmFormsHelper.php) covers the submit-area classes, andtest_generated_css_aligns_inline_flex_submit_with_inputs(test_FrmStyle.php) covers the generated CSS rules. Neither can check the rendered position:frm_flexonly becomes a flex row with Pro active, and Lite's CI has no Pro.🤖 Generated with Claude Code