Skip to content

Fix Style builder labels focusing hidden color-picker/slider inputs - #3449

Open
vivi-the-going-merry[bot] wants to merge 16 commits into
masterfrom
fix/issue-3439-style-label-focus-targets
Open

vivi-the-going-merry[bot] wants to merge 16 commits into
masterfrom
fix/issue-3439-style-label-focus-targets

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What was broken

In Formidable > Styles, several <label for="..."> elements target inputs
that are hidden from the visible/interactive DOM, so clicking the label
doesn't focus anything a user can see:

  • Color pickers (js/admin/style.js's .wpColorPicker() call): WP's
    color picker hides the original input.hex and shows a .wp-color-result
    button instead. The button never carried a matching id, so every color
    label's for still targeted the now-hidden input.
  • Single-value sliders (classes/views/styles/components/templates/slider.php):
    the visible number input next to the slider handle had no id at all, so
    the label's for targeted the slider's hidden "real" value input instead.

What changed

  • js/admin/style.js: after each color picker initializes, give its
    .wp-color-result button an {id}_visible id and repoint the matching
    label's for to it. One choke point, covers every color picker in every
    Style view.
  • slider.php: give the visible number input an {id}-value id.
  • Repointed every affected label's for to the new id, for fields whose
    value is always a single number (font sizes, widths, heights, border
    widths/radii).

Scope - padding/margin sliders excluded

FrmSliderStyleComponent renders either a single input or a 4-way
top/bottom/left/right group depending on the currently saved value
(has-multiple-values = count(explode(' ', $field_value)) > 1), so the
same field (e.g. field_pad/field_margin) can render either shape at
different times. A static for in the calling template can't reliably
target the right element for both shapes - some multi-value labels in this
codebase already leave for off entirely for this reason (e.g.
_form-description.php's Margin/Padding labels). Fixing this properly needs
the component itself to own the association (e.g. role="group" +
aria-labelledby for the multi-value shape), which is a bigger change than
this PR - left out of scope. Affected ids: frm_field_pad,
frm_field_margin, frm_label_padding, frm_submit_margin,
frm_submit_padding, frm_description_margin, frm_form_desc_padding,
frm_fieldset_padding, frm_style_qsettings_field_margin,
frm_style_qsettings_field_pad, plus the two independent_fields margin
sliders in _form-title.php/_form-description.php.

Verification

Added tests/cypress/e2e/Styles/styleLabelFocusTargets.cy.js, which clicks
a color-picker label and a single-value-slider label directly and asserts
focus lands on the visible control. Could not run Cypress locally this
session (Docker/wp-env mount gap against a scratch clone under /tmp -
~/Claude/test-sites/formidable/formidable was mid-use by another
in-progress task) - relying on this PR's own CI run (run e2e tests label
added) for the actual red/green signal.

Addresses (partially) #3439 - see Scope section above for what's
intentionally left. Not adding a closing keyword since the padding/margin
part of the issue is still open; will comment on the issue directly instead.

Color pickers: wpColorPicker() hides the original input and shows a
.wp-color-result button instead, but nothing repointed the label's `for`
to follow it - clicking a color swatch's own label did nothing. Fix
this once in style.js for every color picker, right after init.

Single-value sliders: the visible text input next to the slider handle
had no id at all, so every label's `for` targeted the slider's hidden
"real" input instead - same dead-click problem. Give that input an
`{id}-value` id and repoint the corresponding labels.

Scope: only sliders whose value is always a single number (font sizes,
widths, heights, border widths/radii). Padding/margin sliders render as
either a single input or a 4-way group depending on the currently saved
value (FrmSliderStyleComponent::get_values()), so a static `for` can't
target the right element either way - left out of scope, needs the
component itself to own the association rather than the caller.

Fixes #3439 (partial - see PR description for the excluded scope)
Clicks each label directly and asserts focus lands on the visible
control (color-swatch button / slider number input), not the hidden
input the label used to be wired to.
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: Strategy11/formidable-forms/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 357e1a36-5805-4313-ab91-1ecc454bfdc2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vivi-the-going-merry vivi-the-going-merry Bot added run analysis run e2e tests Run the Cypress end-to-end suite on this PR labels Sep 22, 2026
@deepsource-io

deepsource-io Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in efe122d...dcb95ff on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

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.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Oct 1, 2026 6:59p.m. Review ↗
JavaScript Oct 1, 2026 6:59p.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.

…s original one

style.js repoints the color-picker label's `for` to `{id}_visible` as soon as
wpColorPicker() initializes, which happens before Cypress's query runs - the
test was still selecting the pre-init id, so cy.get() never found it (the
label genuinely no longer carries that attribute value, not a visibility
issue). No production code changed; the slider case in the same file was
unaffected since PHP already renders its label with the final id statically.
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Status: parking, CI not yet confirmed on the latest push.

  • Cypress shard 1 failure (Form Templates/FormTemplates.cy.js) is an unrelated pre-existing flake — different spec entirely, a Cypress spec-bridge visibility timeout, not touched by this PR.
  • Cypress shard 3 failure was this PR's own new test, styleLabelFocusTargets.cy.js's color-picker case — genuinely red, not a flake: label[for="frm_style_qsettings_submit_bg_color"] was never found. Root cause: style.js's fix repoints that label's for to {id}_visible as soon as wpColorPicker() initializes (which happens before Cypress's query runs), so the test was still asserting against the pre-init id — the label genuinely no longer carries that value, this isn't a visibility timing issue. Fixed the test to select the post-init id instead; no production code changed. Pushed as a771f0d78.
  • Not yet re-confirmed green — swapping this back to pickup so the next tick verifies CI and closes this out rather than claiming done without having seen it.

…ot after

WP core's own color-picker.js open() intentionally un-hides
.wp-picker-input-wrap (which contains the original input) when the
swatch button is clicked, exposing it as the manual hex-entry field.
Asserting it stays hidden post-click fails against that by-design
behavior; the real regression coverage is that it's hidden before any
interaction and that the click lands focus on the visible swatch
button.

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Live-verified against this PR's own branch in wp-preview-env (WP admin > Formidable > Styles).

Color-picker case confirmed both by DOM state and by screenshot - clicking the repointed label focuses the visible .wp-color-result swatch button (document.activeElement -> id: frm_style_qsettings_submit_bg_color_visible, class: button wp-color-result wp-picker-open):

color picker label click focuses the visible swatch button, showing a focus ring

Slider case confirmed via DOM/attribute snapshot (not screenshotted - a for/focus-target change on a plain text input isn't pixel-visible either way): clicking label[for="frm_fieldset-value"] moves document.activeElement to { activeId: "frm_fieldset-value", activeTag: "INPUT" }, and the old real input (#frm_fieldset) is confirmed display: none - matches the PR's own new Cypress assertions exactly.

Also independently confirmed via CI log read that the shard-1 Cypress failure is Form Templates/FormTemplates.cy.js, an unrelated pre-existing spec, not this PR's own new test - matches the existing PR comment's diagnosis. Traced DeepSource's 2 flagged PHP-W1066 issues (slider.php:169/172) via git blame to commits from 2026-08-07/2026-09-15, both predating this PR - pre-existing code the diff only shifted via line-count, not a new issue introduced here.

One real gap in the fix itself, inline below - not a regression, but it means the fix doesn't actually apply to 2 of its own target fields in the plugin's default state, with no test coverage to catch it. Couldn't reach that field's section via a stable click in this session to screenshot it directly, so that specific claim rests on the DOM check + source trace in the inline comment, not a screenshot - noting the gap explicitly rather than implying more coverage than was actually exercised.

Comment thread classes/views/styles/_buttons.php Outdated
<div class="frm5 frm_form_field">
<label
for="frm_submit_width"
for="frm_submit_width-value"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submit_width/submit_height default to 'auto' (classes/models/FrmStyle.php:809-810). FrmSliderStyleComponent::detect_unit_measurement() returns the literal 'auto' for that value, and is_measured_unit('auto') is false (only px/em/% count), so slider.php's new id="...-value" input renders disabled for these two fields by default - live-confirmed on this PR's own branch via playwright-cli eval: document.getElementById('frm_submit_width-value').disabled === true on the plugin's default style.

A <label> click does not focus an associated disabled control (spec behavior, not a bug in this PR's own JS/PHP) - so for="frm_submit_width-value" (here) and for="frm_submit_height-value" (line 111) are no-ops on any brand-new style, which is the plugin's out-of-the-box state. That's the exact class of bug this PR sets out to fix, just still unfixed for these two fields until a user manually switches the unit dropdown off "auto" - and neither new Cypress test exercises an auto-default field, so this ships uncaught.

The PR's own description already documents a matching precedent for a field that can't have a static, reliable focus target - the multi-value padding/margin sliders leave for off entirely rather than pointing at something unreliable. Worth the same treatment here: omit (or JS-conditionally set) for for submit_width/submit_height while their unit is non-measured, rather than leaving it pointed at a disabled input.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: omitted for while the unit is non-measured, added a data-slider-label-for marker, and JS re-associates for once the unit becomes measured (and drops it again on switching back to auto/unset). Verified live via wp-env + Cypress.

…lugin's default auto unit

Both fields default to 'auto' (FrmStyle.php), which renders their slider
value input disabled - a label click never focuses a disabled control, so
the fix's own <label for="..."> was a no-op out of the box. Omit `for` at
render while the unit is non-measured, and re-associate it via JS once a
measured unit is chosen, matching detect_unit_measurement()'s definition of
"measured". Extends styleLabelFocusTargets.cy.js to cover both states.
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Method: in-place push
Pushed to: #3449 (branch fix/issue-3439-style-label-focus-targets, unchanged PR number)

Fixed the gap: Width/Height default to auto (FrmStyle.php), rendering their value input disabled. Label now omits for while the unit is non-measured (auto or unset), carries a stable data-slider-label-for marker, and slider-component.js re-associates for once a measured unit is chosen (and drops it again if switched back) - closes the loop in both directions, not just the initial render. Compiled js/formidable-settings-components.js hand-patched to match (no JS build step in CI).

Verified locally via a real wp-env + Cypress run (not just CI): both new assertions in styleLabelFocusTargets.cy.js pass, plus the full existing sliderComponent.cy.js suite (6/6, no regressions).

Self-review flagged one real gap not fixed here: the same disabled-input-plus-for defect likely affects ~20 other single-value slider labels in this file family, none of which ship with a non-measured default today. Filed as #3454 rather than expanding this PR's scope.

@vivi-the-going-merry vivi-the-going-merry Bot removed the vivi-working Vivi is actively working this label Sep 23, 2026
Comment thread classes/views/styles/_buttons.php Outdated
<label
for="frm_submit_width"
data-slider-label-for="frm_submit_width-value"
<?php echo FrmSliderStyleComponent::is_value_measured( $style->post_content['submit_width'] ) ? 'for="frm_submit_width-value"' : ''; ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_buttons.php Outdated
<label
for="frm_submit_height"
data-slider-label-for="frm_submit_height-value"
<?php echo FrmSliderStyleComponent::is_value_measured( $style->post_content['submit_height'] ) ? 'for="frm_submit_height-value"' : ''; ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 9591399. Live-verified this commit's fix directly against the PR's own branch (wp-preview-env, WP admin > Formidable > Styles > Buttons), not just read from source:

  • Default auto state (the exact gap I flagged last round): #frm_submit_width renders auto, #frm_submit_width-value is disabled: true, and [data-slider-label-for="frm_submit_width-value"] has no for attribute (null) — confirmed via DOM eval, not just the screenshot below:

Width slider showing the disabled/greyed track with unit dropdown set to "auto"

  • Switching to a measured unit re-associates the label live: selecting px flips inputDisabled to false and restores for="frm_submit_width-value"; clicking the label afterward actually moves document.activeElement to that input ({activeId: "frm_submit_width-value", activeTag: "INPUT"}).
  • Switching back to auto drops it again, live — not just on next server render: for goes back to null immediately after re-selecting auto, no reload needed.

This matches the new Cypress case (styleLabelFocusTargets.cy.js) exactly, which is also green in this PR's own CI (shard 3) — a second, independent confirmation via a real browser run, not just this session's manual check.

Also checked since my last review:

  • is_value_measured()/detect_unit_measurement() (source read): auto and unset "" both fail is_measured_unit(), only px/em/% pass — matches the disabled-input condition exactly, and explains why Width/Height specifically needed this (they're the only sliders that ship with a non-measured default today).
  • Hand-patched js/formidable-settings-components.js (no JS build in CI) checked against slider-component.js line-by-line — the minified updateLabelFocusTarget and its three call sites match the source exactly.
  • DeepSource's new PHP flag ($style might not be defined, _buttons.php:93/113) is a false positive: $style is used identically dozens of other times in this same file/scope (e.g. line 100, two lines below one of the flagged lines) with no complaint — the only difference is the new lines put the echo inline as a bare tag attribute instead of a full statement. Psalm and PHPStan both pass clean on this same commit.
  • Scoping the other ~20 single-value slider labels out to #3454 is reasonable: per the PR body, none of them currently ship with a non-measured default, so this specific bug doesn't reproduce there today.

Nothing blocking. Approving.

PR #3449 fixed the same defect (a <label for="..."> pointing at a
slider's value input that renders disabled whenever its unit is
non-measured) for Width/Height only, since those are the only two
fields that ship with a non-measured ('auto') default today.

The other ~20 single-value slider labels (font sizes, border widths,
corner radii, etc.) still use a static for="{id}-value" with no
conditional - none of them default to a non-measured unit, so there's
no live bug in the default state, but a user can still clear any
slider's unit to blank ("Not set", which every slider offers) and
disable that field's own label the same way.

Apply the same data-slider-label-for marker + FrmSliderStyleComponent
::is_value_measured() conditional `for` to every remaining plain
for="{id}-value" label in classes/views/styles/. No JS change needed -
style.js's updateLabelFocusTarget() already selects generically by
[data-slider-label-for], so this is template-only.

Extends styleLabelFocusTargets.cy.js with a case covering the "Not
set" unit for a field outside PR #3449's own Width/Height scope
(frm_fieldset, already visited by the existing single-value-slider
test).

Addresses #3454. Branched on top of PR #3449's own branch
(fix/issue-3439-style-label-focus-targets) since the mechanism this
extends doesn't exist on master yet - not opening a PR against master
until #3449 merges.
@vivi-the-going-merry vivi-the-going-merry Bot added the vivi-working Vivi is actively working this label Sep 30, 2026
vivi-the-going-merry Bot and others added 2 commits September 30, 2026 11:27
Conflicts: styles label for= hunks (kept slider data-slider-label-for, master's
dangling for= removals elsewhere) and the settings-components bundle (took
master's, hand-reapplied updateLabelFocusTarget and its three call sites).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… focus spec

CI shard 1 timed out after 4s waiting for the Styles page markup; sliderComponent.cy.js
already uses 10s for the same first lookup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vivi-the-going-merry vivi-the-going-merry Bot removed the vivi-working Vivi is actively working this label Sep 30, 2026
@vivi-the-going-merry

vivi-the-going-merry Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Method: in-place push
Pushed to: #3449 (branch fix/issue-3439-style-label-focus-targets, unchanged PR number)

Merged master (no force-push). Conflicts were the Styles view label attributes (kept the slider data-slider-label-for markup, took master's dangling for= removals elsewhere) and js/formidable-settings-components.js (took master's bundle, hand-reapplied updateLabelFocusTarget and its three call sites). js/src and js/admin/style.js merged cleanly.

Verified locally against the merged result: styleLabelFocusTargets.cy.js 4/4 and sliderComponent.cy.js 6/6. CI at 510d6a4: lint, static analysis and PHPUnit green; Cypress shards 0, 2 and 3 green, including both specs above. Shard 1 fails only admin-html-validation.cy.js (form list: '#posts-filter' form has no submit button, wcag/h32), a page this PR does not touch; the same spec also failed in another PR's run today (different error). I can't re-run jobs, so franky-review is not added. Re-run shard 1 and add franky-review if that holds.

Comment thread classes/views/styles/_buttons.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_submit_font_size-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'submit_font_size', 'frm_submit_font_size-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_buttons.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_submit_border_width-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'submit_border_width', 'frm_submit_border_width-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_buttons.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_submit_border_radius-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'submit_border_radius', 'frm_submit_border_radius-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_check_font_size-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'check_font_size', 'frm_check_font_size-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_field-colors.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_field_border_width-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'field_border_width', 'frm_field_border_width-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_form-messages.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_success_font_size-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'success_font_size', 'frm_success_font_size-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_form-messages.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_error_font_size-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'error_font_size', 'frm_error_font_size-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_form-title.php Outdated
<div class="frm5 frm_form_field">
<label
data-slider-label-for="frm_title_size-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'title_size', 'frm_title_size-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_general.php Outdated
for="frm_fieldset"
<label
data-slider-label-for="frm_fieldset-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'fieldset', 'frm_fieldset-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Comment thread classes/views/styles/_general.php Outdated
for="frm_form_width"
<label
data-slider-label-for="frm_form_width-value"
<?php FrmSliderStyleComponent::maybe_echo_for( $style, 'form_width', 'frm_form_width-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Border Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'field_border_width', 'frm_field_border_width-value', __( 'Border Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Border Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'border_width_error', 'frm_border_width_error-value', __( 'Border Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'description_font_size', 'frm_description_font_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'font_size', 'frm_font_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'width', 'frm_width-value', __( 'Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'success_font_size', 'frm_success_font_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'error_font_size', 'frm_error_font_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'title_size', 'frm_title_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_fieldset"
class="frm-style-item-heading"><?php esc_html_e( 'Border Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'fieldset', 'frm_fieldset-value', __( 'Border Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_form_width"
class="frm-style-item-heading"><?php esc_html_e( 'Form Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'form_width', 'frm_form_width-value', __( 'Form Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

</div>

<div class="frm5 frm_form_field"><label class="frm-style-item-heading"><?php esc_html_e( 'Margin', 'formidable' ); ?></label></div>
<div class="frm5 frm_form_field"><?php FrmSliderStyleComponent::style_item_heading( $style, 'form_desc_margin_top', 'frm_form_desc_margin_top-value', __( 'Margin', 'formidable' ) ); ?></div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

</div>

<div class="frm5 frm_form_field"><label class="frm-style-item-heading"><?php esc_html_e( 'Padding', 'formidable' ); ?></label></div>
<div class="frm5 frm_form_field"><?php FrmSliderStyleComponent::style_item_heading( $style, 'form_desc_padding', 'frm_form_desc_padding-value', __( 'Padding', 'formidable' ) ); ?></div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Margin', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'title_margin_top', 'frm_title_margins-value', __( 'Margin', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_fieldset_padding"
class="frm-style-item-heading"><?php esc_html_e( 'Padding', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'fieldset_padding', 'frm_fieldset_padding-value', __( 'Padding', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.


<div class="frm5 frm_form_field">
<label
<?php FrmSliderStyleComponent::echo_label_attributes( $style, 'submit_margin', 'frm_submit_margin-value' ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

class="frm-style-item-heading">
<?php esc_html_e( 'Padding', 'formidable' ); ?>
</label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_padding', 'frm_submit_padding-value', __( 'Padding', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Margin', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'description_margin', 'frm_description_margin-value', __( 'Margin', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Padding', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'label_padding', 'frm_label_padding-value', __( 'Padding', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Padding', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'field_pad', 'frm_field_pad-value', __( 'Padding', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Margin', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'field_margin', 'frm_field_margin-value', __( 'Margin', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

@franky-the-going-merry franky-the-going-merry Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at c44309a. Approve, with four non-blocking notes (three inline, one below). This head is a refactor of the one I approved at 9591399: Mike Letellier's later commits moved the label markup into FrmSliderStyleComponent::style_item_heading() and extended it to 35 slider labels.

Verified live (preview env, Lite at this head, Styles page, quick-settings and advanced-settings views): audited all 100 label.frm-style-item-heading elements against the DOM. Of the 93 labels that carry a for, 83 (advanced view) and 84 (quick view) resolve to an existing, enabled, displayed control. 7 more point at the visually hidden checkbox inside a toggle (existing pattern; Remove Box Shadow is the one this PR touches). Width and Height ship auto and correctly carry no for, only data-slider-label-for. There are no disabled targets and no duplicate *-value ids among the 35 new targets. The remaining non-resolving labels:

  • Base Font Size on the advanced view: its slider has not_show_in => advanced-settings, so the whole row is hidden (0×0). On the quick view the target exists, is enabled and is visible.
  • Alignment/Direction (frm_form_align/frm_direction): hidden labels whose for also dangles on master. Not touched here.

Source-verified: I cross-checked all 35 call sites programmatically. Each one's key, input id and the following FrmSliderStyleComponent's id/value key line up; four needed a manual read because those components have a different shape. js/admin/style.js rebuild matches the committed file exactly. js/formidable-settings-components.js has the same updateLabelFocusTarget code as the rebuild. The only differences are 22 lines of minifier and transpile naming noise in code this PR doesn't touch.

CI: PHPUnit (7.4–8.4), Psalm and all 4 Cypress shards pass, including styleLabelFocusTargets.cy.js. At this head PHPCS, PHPStan, ESLint, Rector, CS Fixer, Mago, Stylelint and Oxlint all report "skipping", so no linter ran on the refactor. I ran ESLint on the two hand-written JS files: nothing on changed lines (the one error is a missing sonarjs rule definition in my local plugin set). I didn't lint the PHP; the host has no PHP, though the Styles page rendered on PHP 8.5 with the PR loaded. DeepSource's PHP check is red; I couldn't read its findings from the API.

Not exercised: the multi-value (explode) path in echo_label_attributes() beyond the Buttons "Margin" row's initial render; I didn't switch units on it.

Non-blocking, not inline: no PHPUnit covers the new public statics is_value_measured() and echo_label_attributes(). Cypress touches 3 of the 35 call sites. A small data-provider test ('10px', '12.5', 'auto', '', '10px 5px') is cheap and pins the auto/unset rule the whole PR depends on.

Comment on lines +387 to +405
/**
* Print a label's for attribute when its slider value input is enabled.
*
* @since x.x
*
* @param object $style The style containing the saved values in post_content.
* @param string $key The style setting key.
* @param string $input_id The slider value input ID.
*
* @return void
*/
public static function maybe_echo_for( $style, $key, $input_id ) {
if ( ! self::is_value_measured( $style->post_content[ $key ] ) ) {
return;
}

FrmAppHelper::array_to_html_params( array( 'for' => $input_id ), true );
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe_echo_for() has no callers anywhere (grep -rn maybe_echo_for classes js tests returns only this definition). It also differs from echo_label_attributes() by skipping the explode( ' ', ... ) multi-value handling, so it would be wrong for the margin/padding rows if someone used it. Delete it.

Suggested change
/**
* Print a label's for attribute when its slider value input is enabled.
*
* @since x.x
*
* @param object $style The style containing the saved values in post_content.
* @param string $key The style setting key.
* @param string $input_id The slider value input ID.
*
* @return void
*/
public static function maybe_echo_for( $style, $key, $input_id ) {
if ( ! self::is_value_measured( $style->post_content[ $key ] ) ) {
return;
}
FrmAppHelper::array_to_html_params( array( 'for' => $input_id ), true );
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted in a9a9966.

Comment on lines +448 to +452
* Keeps a value input's <label for="..."> pointed at it only while it is enabled - a label
* click never focuses a disabled control, so leaving `for` set while the unit is non-measured
* ('auto' or unset) makes the label a permanent no-op instead of clearing on the initial PHP
* render alone (see `_buttons.php`'s `data-slider-label-for`, which templates use to mark the
* label without committing to a `for` that may start out invalid).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note about _buttons.php no longer holds. data-slider-label-for is now printed for all 35 slider labels by FrmSliderStyleComponent::echo_label_attributes(), so point there. It also runs to 5 lines where the gotcha fits in 2.

Suggested change
* Keeps a value input's <label for="..."> pointed at it only while it is enabled - a label
* click never focuses a disabled control, so leaving `for` set while the unit is non-measured
* ('auto' or unset) makes the label a permanent no-op instead of clearing on the initial PHP
* render alone (see `_buttons.php`'s `data-slider-label-for`, which templates use to mark the
* label without committing to a `for` that may start out invalid).
* Keep a slider label's `for` on its value input only while the input is enabled, since a label click never focuses a disabled control.
* The label is found by `data-slider-label-for`, printed by `FrmSliderStyleComponent::echo_label_attributes()`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with your wording in a9a9966. Doc comment only, so the compiled bundle is unchanged.

Comment thread classes/views/styles/_field-colors.php Outdated

<div class="frm5 frm_form_field">
<label class="frm-style-item-heading"><?php esc_html_e( 'Remove Box Shadow', 'formidable' ); ?></label>
<label for="remove_box_shadow_active" id="remove_box_shadow_active_label" class="frm-style-item-heading"><?php esc_html_e( 'Remove Box Shadow', 'formidable' ); ?></label>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id="remove_box_shadow_active_label" isn't referenced anywhere (no aria-labelledby, JS or CSS selector uses it; the toggle labels itself through aria-label-attr). Drop it.

Suggested change
<label for="remove_box_shadow_active" id="remove_box_shadow_active_label" class="frm-style-item-heading"><?php esc_html_e( 'Remove Box Shadow', 'formidable' ); ?></label>
<label for="remove_box_shadow_active" class="frm-style-item-heading"><?php esc_html_e( 'Remove Box Shadow', 'formidable' ); ?></label>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the id in a9a9966. Nothing in Lite or Pro references it.

@vivi-the-going-merry vivi-the-going-merry Bot added vivi-working Vivi is actively working this and removed vivi-pickup labels Oct 1, 2026
vivi-the-going-merry Bot and others added 2 commits October 1, 2026 12:57
…rten JS doc

Delete the uncalled FrmSliderStyleComponent::maybe_echo_for(), remove the unreferenced remove_box_shadow_active_label id, and point the updateLabelFocusTarget doc at echo_label_attributes(). PHPUnit coverage for is_value_measured()/echo_label_attributes() still TODO.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pins is_value_measured() and echo_label_attributes() for px/em/%, unitless, auto, empty and multi-value inputs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Method: in-place push
Pushed to: #3449 (branch fix/issue-3439-style-label-focus-targets, unchanged PR number)

Applied Franky's three inline suggestions (a9a9966) and added the data-provider PHPUnit test from the non-inline note (dcb95ff, tests/phpunit/styles/test_FrmSliderStyleComponent.php, pins is_value_measured and echo_label_attributes incl. 12.5, auto, empty, multi-value). New test green locally (12/12); no force-push, no master merge. Compiled js untouched (doc-comment-only change). Left the DeepSource variable warnings alone.

@vivi-the-going-merry vivi-the-going-merry Bot removed the vivi-working Vivi is actively working this label Oct 1, 2026
<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Font Size', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_font_size', 'frm_submit_font_size-value', __( 'Font Size', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_width', 'frm_submit_width-value', __( 'Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Height', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_height', 'frm_submit_height-value', __( 'Height', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Border Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_border_width', 'frm_submit_border_width-value', __( 'Border Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<div class="frm5 frm_form_field">
<label
class="frm-style-item-heading"><?php esc_html_e( 'Corner Radius', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'submit_border_radius', 'frm_submit_border_radius-value', __( 'Corner Radius', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_fieldset"
class="frm-style-item-heading"><?php esc_html_e( 'Border Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'fieldset', 'frm_fieldset-value', __( 'Border Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_fieldset_padding"
class="frm-style-item-heading"><?php esc_html_e( 'Padding', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'fieldset_padding', 'frm_fieldset_padding-value', __( 'Padding', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

<label
for="frm_form_width"
class="frm-style-item-heading"><?php esc_html_e( 'Form Width', 'formidable' ); ?></label>
<?php FrmSliderStyleComponent::style_item_heading( $style, 'form_width', 'frm_form_width-value', __( 'Form Width', 'formidable' ) ); ?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

*/
#[\PHPUnit\Framework\Attributes\DataProvider( 'is_value_measured_provider' )]
public function test_is_value_measured( $value, $expected ) {
$this->assertSame( $expected, FrmSliderStyleComponent::is_value_measured( $value ) );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmSliderStyleComponent::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

ob_start();
FrmSliderStyleComponent::echo_label_attributes( $style, 'submit_width', 'frm_submit_width-value' );

$this->assertSame( $expected, ob_get_clean() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmSliderStyleComponent::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at dcb95ff. Approve. The three commits since my c44309a approve resolve all four of my non-blocking notes:

  • Dead maybe_echo_for() is removed. Nothing in PHP, JS or SCSS references it (grep over the checkout).
  • The unreferenced remove_box_shadow_active_label id is dropped from _field-colors.php; no reference to it remains anywhere.
  • The updateLabelFocusTarget docblock now points at FrmSliderStyleComponent::echo_label_attributes(). The change is comment-only in slider-component.js, so the committed bundles have nothing to rebuild.
  • New test_FrmSliderStyleComponent.php covers is_value_measured() (px/em/%/unitless/auto/empty) and echo_label_attributes() (including 10px 5px and auto 5px).

Test run: I ran the new test's 12 cases outside the WP harness (a stub script loading the real FrmSliderStyleComponent.php, since both methods are pure statics): 0 failures. With is_measured_unit() forced to true, 7 fail (the auto, empty, unitless and auto 5px rows), so the tests do catch the rule the PR depends on. I did not run it through PHPUnit in a WP install.

Not re-checked live: nothing visual changed since c44309a (one id removed from a label that keeps its for, plus comments), so I didn't re-screenshot; my live audit of all 100 style labels at that head stands.

Open: DeepSource: PHP is red at this head. I couldn't see which issues it flags (no annotations or inline comments; the run page doesn't render without a login). Earlier rounds traced its flags to pre-existing lines or a $style false positive, but I haven't confirmed this run's flags are the same ones. Cypress still exercises only 3 of the 35 call sites, which is acceptable now that the PHP logic is unit tested.

@franky-the-going-merry

Copy link
Copy Markdown
Contributor

@stephywells — round-trip cap hit (franky-review↔vivi-pickup × 3/3). Needs a human call before another handoff goes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full automated qa Run analysis, PHPUnit, and Cypress E2E workflows priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant