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
This branches off PR #3449's own branch (fix/issue-3439-style-label-focus-targets), not master - the mechanism this extends (data-slider-label-for marker, FrmSliderStyleComponent::is_value_measured(), JS updateLabelFocusTarget()) doesn't exist on master yet. See Merge notes at the bottom for what has to happen once #3449 lands.
What was broken
Follow-up from #3449's own self-review, filed as #3454: #3449 fixed the disabled-input-label defect (a <label for="..."> pointing at a slider value input that's disabled whenever its unit is non-measured) for Width/Height only, since those are the only two fields shipping a non-measured (auto) default today.
The other ~20 single-value slider labels (font sizes, border widths, corner radii, etc.) still used a static for="{id}-value" with no conditional. None of them default to a non-measured unit, so there's no live default-state bug - but a user can manually clear any slider's unit to blank ("Not set", an option every slider offers), which disables that field's value input and makes its label a dead click the same way.
What changed
Applied 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/ (_buttons.php, _check-box-radio-fields.php, _field-colors.php, _field-description.php, _field-labels.php, _field-sizes.php, _form-description.php, _form-messages.php, _form-title.php, _general.php, _quick-settings.php).
No JS change needed - style.js's updateLabelFocusTarget() already selects generically by [data-slider-label-for], so this is template-only.
Verification
Extended tests/cypress/e2e/Styles/styleLabelFocusTargets.cy.js with a case covering the "Not set" unit for frm_fieldset (Border Width, General section) - a field outside #3449's own Width/Height scope. Could not run Cypress locally this session (same Docker/wp-env mount gap as #3449).
This PR's own CI only shows green, not red-then-green - the test and the fix landed in the same commit, so there was no point where the new assertions ran against pre-fix code in this PR's own history. Confirmed the structural reason a revert would go red instead of actually reverting and re-pushing (which would cost another full Cypress cycle): on #3449's branch (this PR's base) [data-slider-label-for="frm_fieldset-value"] doesn't exist at all, so the new test's first cy.get() for that selector would fail deterministically without this PR's template changes.
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.
We reviewed changes in 9591399...63d47ac on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
We reviewed changes in 9591399...63d47ac 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.
Verified live: booted this PR's branch in the WP Playground preview env, logged into /wp-admin, and drove the exact frm_fieldset (Border Width, General section) round trip the new Cypress test covers — measured unit → label has for, unit cleared to "Not set" → value input disables and the label's for drops, unit restored → for comes back. Matches the new test's assertions exactly.
Cross-checked all 21 new data-slider-label-for/is_value_measured() sites programmatically: marker id, conditional for value, post_content key, and the FrmSliderStyleComponent's own 'id' constructor arg all agree at every site — no copy-paste mismatch anywhere in the diff.
CI notes (neither blocks this diff): E2E Test / Cypress (shard 1)'s failure is Form Templates/FormTemplates.cy.js — an unrelated pre-existing modal-visibility timeout, nothing to do with style-builder labels (the new styleLabelFocusTargets.cy.js case is in shard 3, which passed). DeepSource: PHP's "$style might not be defined" flags are a pre-existing false-positive pattern in this template — $style is populated by the including controller and was already used unflagged elsewhere in the same files (e.g. _buttons.php:24) before this diff.
Two non-blocking structural notes below — good candidates for a fast follow-up, not required for this PR.
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking, repo-wide pattern (all 21 new sites in this diff, not just this one): the decision to print for="..." is duplicated per-site as a PHP conditional keyed off is_value_measured(), when slider-component.js's initListeners() already resolves valueInput.disabled for every slider at page load via the same underlying is_measured_unit() logic (slider.php:132's disabled() call). A single JS init-time pass — find the label via the existing [data-slider-label-for="..."] marker and call updateLabelFocusTarget(valueInput, !valueInput.disabled) once per slider — would let every template (this PR's 21 sites plus any future single-value slider) keep a plain static for and never need this conditional at all, closing off the exact bug class #3454/#3449/this PR keep re-fixing one site at a time. Worth a fast follow-up rather than blocking this PR, since the current approach is correct, just more maintenance surface than it needs to be.
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: each of the 21 sites hand-types the {id}-value string twice (once in data-slider-label-for, once in the conditional for), plus a third time a few lines below in the FrmSliderStyleComponent constructor's 'id' option. A small static helper on FrmSliderStyleComponent — e.g. label_for_attrs( $id, $value ) printing both attributes from one $id — would cut the two adjacent literals in the <label> down to one, at all 21 sites. If going this route, note phpcs.xml:76's WordPress.Security.EscapeOutput.OutputNotEscaped sniff will need the helper allowlisted (or self-escaping) since it'd be echoed directly, same as FrmAppHelper::array_to_html_params() already handles elsewhere in this codebase.
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.
Stacked on #3449
This branches off PR #3449's own branch (
fix/issue-3439-style-label-focus-targets), notmaster- the mechanism this extends (data-slider-label-formarker,FrmSliderStyleComponent::is_value_measured(), JSupdateLabelFocusTarget()) doesn't exist onmasteryet. See Merge notes at the bottom for what has to happen once #3449 lands.What was broken
Follow-up from #3449's own self-review, filed as #3454: #3449 fixed the disabled-input-label defect (a
<label for="...">pointing at a slider value input that'sdisabledwhenever its unit is non-measured) for Width/Height only, since those are the only two fields shipping a non-measured (auto) default today.The other ~20 single-value slider labels (font sizes, border widths, corner radii, etc.) still used a static
for="{id}-value"with no conditional. None of them default to a non-measured unit, so there's no live default-state bug - but a user can manually clear any slider's unit to blank ("Not set", an option every slider offers), which disables that field's value input and makes its label a dead click the same way.What changed
Applied the same
data-slider-label-formarker +FrmSliderStyleComponent::is_value_measured()conditionalforto every remaining plainfor="{id}-value"label inclasses/views/styles/(_buttons.php,_check-box-radio-fields.php,_field-colors.php,_field-description.php,_field-labels.php,_field-sizes.php,_form-description.php,_form-messages.php,_form-title.php,_general.php,_quick-settings.php).No JS change needed -
style.js'supdateLabelFocusTarget()already selects generically by[data-slider-label-for], so this is template-only.Verification
Extended
tests/cypress/e2e/Styles/styleLabelFocusTargets.cy.jswith a case covering the "Not set" unit forfrm_fieldset(Border Width, General section) - a field outside #3449's own Width/Height scope. Could not run Cypress locally this session (same Docker/wp-env mount gap as #3449).This PR's own CI only shows green, not red-then-green - the test and the fix landed in the same commit, so there was no point where the new assertions ran against pre-fix code in this PR's own history. Confirmed the structural reason a revert would go red instead of actually reverting and re-pushing (which would cost another full Cypress cycle): on #3449's branch (this PR's base)
[data-slider-label-for="frm_fieldset-value"]doesn't exist at all, so the new test's firstcy.get()for that selector would fail deterministically without this PR's template changes.Addresses #3454.
Closes #3454
Merge notes:
masterif Fix Style builder labels focusing hidden color-picker/slider inputs #3449's branch is deleted on merge. If it isn't deleted, change the base manually before merging.git rebase --onto origin/master <3449-head-sha>.