Skip to content

Replace global Enable AI toggle with tri-state section master toggles#617

Open
itzmekhokan wants to merge 2 commits into
WordPress:developfrom
itzmekhokan:fix/section-master-toggle-tri-state
Open

Replace global Enable AI toggle with tri-state section master toggles#617
itzmekhokan wants to merge 2 commits into
WordPress:developfrom
itzmekhokan:fix/section-master-toggle-tri-state

Conversation

@itzmekhokan
Copy link
Copy Markdown

@itzmekhokan itzmekhokan commented May 23, 2026

Fixes #600 by implementing Option B from the issue: remove the global Enable AI header toggle and add a tri-state section master toggle to each experiment group.

  • Off — no features enabled in the section
  • Indeterminate — some but not all features enabled (distinct visual treatment)
  • On — all features in the section enabled
    The header toggle was misleading because it reflected only wpai_features_enabled, not the aggregate state of sub-features. Section-level controls scale better as more experiment groups are added and align with existing Enable all / Disable all actions.
    Changes also:
  • Sync wpai_features_enabled automatically when feature toggles change (enabled when any feature is on, disabled when none are)
  • Keep individual feature toggles interactive regardless of global option state
  • Remove bulk-action disabling tied to the old global header toggle

Test plan

  • Open AI settings and confirm there is no global Enable AI toggle in the page header
  • Confirm each section (Editor Experiments, Admin Experiments, etc.) shows an Enable {Section} master toggle
  • Enable only a subset of features in Editor Experiments → section master toggle shows indeterminate (not fully on)
  • Click indeterminate section toggle → all features in that section enable
  • Click fully-on section toggle → all features in that section disable
  • Enable all / Disable all still work and remain enabled in mixed states
  • Individual feature toggles remain interactive when a section is fully disabled
  • Run npm run test:e2e -- tests/e2e/specs/admin/settings.spec.js
  • Run npm run test:php
Open WordPress Playground Preview

Implements issue WordPress#600 Option B by removing the misleading page-header
toggle and adding tri-state section controls that reflect aggregate
feature state, while syncing wpai_features_enabled from feature edits.
Add JSDoc param tags and apply prettier formatting required by wp-scripts.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @manueldiaz2006t-blip.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: manueldiaz2006t-blip.

Co-authored-by: itzmekhokan <khokansardar@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.18%. Comparing base (3624c91) to head (3c2a8a6).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #617   +/-   ##
==========================================
  Coverage      73.18%   73.18%           
  Complexity      1731     1731           
==========================================
  Files             85       85           
  Lines           7473     7473           
==========================================
  Hits            5469     5469           
  Misses          2004     2004           
Flag Coverage Δ
unit 73.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul
Copy link
Copy Markdown
Member

The new toggle added feels duplicative with the Enable all // Disable all buttons at the end of each section:

Image

The buttons feel sufficient, though perhaps an alternate UI treatment instead of two distinct buttons could be better so I'm open to ideas/discussion there.

@jeffpaul jeffpaul added this to the 1.1.0 milestone May 26, 2026
@dkotter dkotter modified the milestones: 1.0.1, 1.1.0 May 26, 2026
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.

Enable AI header toggle doesn't reflect aggregate state of sub-features

3 participants