Repository navigation
Toggle settings only with the checkbox; explain each setting - #185
Conversation
A click on a setting's title or description, or a drag across it to select the text, turned the setting on or off: WordPress printed the title as a label for the checkbox, and the description sat inside a second label. Checkboxes now register without label_for, so the title is plain text, and carry a label for screen readers only. Each setting now shows three short paragraphs below its control: what it does, its effect on the site, and its performance gain or cost. They replace the one-line descriptions and follow what each option does on WordPress 7.0 and 7.1. The two domain lists show the same three parts, then their format rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for contributing to EngineScript Site Optimizer! Before we review:
Security Reminder
We'll review your PR soon. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 17 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage · +0.11% coverage variation
Metric Results Coverage variation ✅ +0.11% coverage variation (-1.00%) Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (fa83a1f) 871 841 96.56% Head commit (49b2193) 900 (+29) 870 (+29) 96.67% (+0.11%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#185) 108 108 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary
Only the checkbox changes a setting now. Before, a click on a setting's title or its description turned it on or off, and so did a drag across that text to select it. There were two causes:
add_settings_field()gotlabel_for, so WordPress printed the row title as<label for>.<label>that wrapped the checkbox.Checkbox fields now register without
label_forand carry the option name in anoptionargument, so the title is plain text. Each checkbox has one label, markedscreen-reader-textso it takes no space on screen, andaria-describedbypoints at its help. The text areas keeplabel_for, because a click on their title only puts the cursor in the box.Every setting explains itself. Three paragraphs, "What it does", "Effect on your site" and "Performance", replace the one-line descriptions. They come from the new
es_optimizer_get_option_help(), and every string is translatable. The text was checked against WordPress 7.0 and 7.1.5 core. For example:wp-mail.phprefuse requests.The domain lists show the same three parts, then their format rules under "Format:".
Internal API changes:
es_optimizer_get_checkbox_field_definition()andes_optimizer_register_checkbox_field()no longer take a description.es_optimizer_get_option_name_from_field_args()readsoptionfirst.Testing
composer check-allpasses: PHPCS, PHPMD, Psalm and its taint analysis, PHPStan, Rector, and PHPUnit with 178 tests and 732 assertions. The new tests cover:aria-describedby;main: clicking the title toggled 10 of 11 settings, and clicking the description text toggled all 11. With this branch, neither toggles anything.npm run lint:md, codespell, Plugin Check's PHPCS rulesets, andmsgfmt -con the regenerated POT are clean, and gitleaks finds no leaks.The changelog entries are under "Unreleased" in
CHANGELOG.mdandreadme.txt. The version is unchanged; this is planned to ship with the next feature release.🤖 Generated with Claude Code