Skip to content

fix(save-panel): uncheck disabled remove taxonomy query option. - #902

Open
KarunyaChavan wants to merge 1 commit into
WordPress:trunkfrom
KarunyaChavan:fix/remove-taxonomy-query-checkbox-state
Open

KarunyaChavan wants to merge 1 commit into
WordPress:trunkfrom
KarunyaChavan:fix/remove-taxonomy-query-checkbox-state

Conversation

@KarunyaChavan

Copy link
Copy Markdown

When the "Remove Taxonomy Query" option was introduced, the disabled guard was added to prevent user interaction when neither templates nor patterns were selected to save, but the matching guard on the checked prop was overlooked. As a result, the control retained checked={ preference.removeTaxQuery } without taking parent state into account, leaving it visibly checked when disabled, unlike its sibling controls which mask their visual checked state when inactive.

Fixes #901

What Changed?

  • Synchronized visual state: Updated the checked attribute of the "Remove Taxonomy Query" checkbox so that it unchecks when both "Save Template Changes" and "Save Patterns" are disabled.
  • Extracted canSaveTemplatesOrPatterns (DRY): Replaced repeated ! preference.saveTemplates && ! preference.savePatterns and ( preference.saveTemplates || preference.savePatterns ) expressions across all four dependent controls with a single, shared boolean constant.
  • Consistent component behavior: Unified the disabled and checked logic across "Localize Text", "Localize Images", "Remove Navigation Refs", and "Remove Taxonomy Query", preventing future state synchronization discrepancies.

Steps for Testing

  1. Open the Site Editor and activate the Create Block Theme plugin sidebar.
  2. Navigate to Save Changes to Theme.
  3. Check the Save Patterns checkbox.
  4. Ensure that the Remove Taxonomy Query checkbox is checked.
  5. Uncheck the Save Patterns checkbox.
  6. Ensure that the control should become unchecked when disabled, matching the form behavior of the sibling options ("Localize Text", "Localize Images", and "Remove Navigation Refs").

- Ensure the 'Remove Taxonomy Query' checkbox visually unchecks when both 'Save Template Changes' and 'Save Patterns' are disabled, matching the behavior of its peer dependent controls.
- Also extract the repeated template/pattern predicate to keep the condition DRY.
@KarunyaChavan
KarunyaChavan marked this pull request as ready for review November 6, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled "Remove Taxonomy Query" checkbox remains visually checked when parent options are off

1 participant