Skip to content

WordPress 7.1 maintenance: standards, dependencies, wp-env - #51

Draft
jeremyfelt wants to merge 15 commits into
trunkfrom
task/wp-7-1-maintenance
Draft

jeremyfelt wants to merge 15 commits into
trunkfrom
task/wp-7-1-maintenance

Conversation

@jeremyfelt

Copy link
Copy Markdown
Member

What changed

  • Standards: happyprime/coding-standards ^1.0.0-alpha3. Drops the duplicated inline php-compatibility package repository. phpcs.xml.dist uses HappyPrime and enforces the toggle-block text domain and prefixes. PHPStan stays at level 9, scoped to toggle-block.php. ESLint now runs the WordPress i18n rules, and Stylelint and package.json linting are added. Lint scripts are renamed to lint:js / fix:js.
  • CI: phpcs.yml and phpstan.yml become php-checks.yml, js-checks.yml is added, and plugin-check.yml and verify-build.yml are refreshed from the templates.
  • Tested up to 7.1 in readme.txt, the plugin header, and blueprint.json. This clears the Plugin Check failure on trunk.
  • Dependencies: all npm dev dependencies are on their latest versions, including Babel 8 and @wordpress/eslint-plugin 27. Babel 8's preset-react defaults to the development JSX runtime, which WordPress does not register, so webpack.config.js sets development: false. The editor script now depends on react-jsx-runtime. Composer is updated.
  • wp-env: WordPress 7.1 on PHP 8.4 at port 8980, with no tests environment. npm run env:start builds, starts, and seeds demo pages. The README has a Development section.
  • Fixes, each in its own commit:
    • Focus moves into a toggled block that has something to focus, and Escape closes it and returns focus (Apply focus to first focusable element in toggled block #2).
    • aria-expanded stays in sync when several toggles control one block.
    • Deprecations declare their supports. Before, 0.4.0 toggles with an anchor or custom spacing failed validation, and ones with preset colors lost the colors on migration.
    • The block selector only lists blocks that support anchors. Choosing Custom HTML looked like it worked but saved no anchor.
    • A body class with a space in it no longer throws and breaks every later toggle on the page.
    • The help text for "Screen reader text" and "Body class" now shows. It was passed as description, which TextControl ignores.
    • The Link format is gone from the button text, since a link inside a <button> is invalid.
    • The readme documents toggle-block-hidden, toggle-block-group, the focus behavior, and where the source lives.

Version and Stable tag are unchanged.

PRs merged

None.

PRs superseded

Issues

Fixes #2.

Opened: #47 (hidden class does nothing in classic themes), #48 (button sits outside the content column), #49 (screen reader text help and label-in-name), #50 (WordPress.org deploy workflows and assets).

How to test

npm install && composer install
npm run env:start   # http://localhost:8980, admin / password
  • The front page is the demo. Tab to "Show details" and press Enter: focus moves to the link in the panel, and Escape closes the panel and returns focus to the button. "Open menu" moves focus to "Close menu", and closing returns focus to "Open menu". In the toggle group, "Overview" opens by default and reopens when another panel closes.
  • "Toggle Block in navigation": Space on "Search" opens the panel and focuses the search field.
  • In the editor, select a toggle, use "Browse blocks", save, and reload. No block should be invalid.
  • composer phpcs, composer phpstan, npm run lint:js, npm run lint:css, npm run lint:package, npm run build (no diff).

🤖 Generated with Claude Code

https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr

jeremyfelt and others added 15 commits October 9, 2026 16:00
Drop the inline php-compatibility package repository, which was also
declared twice, and the direct php-compatibility require. The standard
now provides PHPCompatibility 10 from real releases.

Rename the ruleset to phpcs.xml.dist, reference HappyPrime by name, and
enforce the text domain and global prefixes so WordPress.org-style
checks run locally. Point PHPStan at the plugin file and use the vendor
path for the shared config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Enforce the toggle-block text domain through the WordPress i18n ESLint
rules, lint CSS with @happyprime/stylelint-config, and lint package.json.
Rename the lint scripts to lint:js and fix:js so the shared js-checks
workflow finds them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Replace phpcs.yml and phpstan.yml with php-checks.yml, add js-checks.yml
for the lint scripts, and refresh plugin-check.yml and verify-build.yml
from the shared templates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Plugin Check fails on trunk because Tested up to trails the current
WordPress release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Babel 8 switches preset-react to the automatic JSX runtime and turns on
its development mode by default. The development runtime is not a
WordPress script handle, so the editor script would never load. Turn it
off; the built script now depends on react-jsx-runtime, which WordPress
has shipped since 6.6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Run WordPress 7.1 on PHP 8.4 at port 8980 with no tests environment, so
this site does not collide with other plugins on 8888 and 8889.

env:start builds the block, starts the site, and runs env:seed, which
activates Twenty Twenty-Five, sets pretty permalinks, and creates pages
that exercise each feature: hidden and visible targets, screen reader
text, a toggle group with a default toggle, a body class, and a toggle
inside a Navigation block.

Keep the new dev files out of the distributed plugin and ignore local
wp-env overrides and test output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
When two toggles control the same block, such as an open button outside
a panel and a close button inside it, only the pressed toggle updated
aria-expanded. The other kept announcing the wrong state. Update every
toggle that controls the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
When a toggle opens a block that contains links, buttons, or form
fields, focus moves to the first one. A keyboard user would otherwise
have to tab through everything between the toggle and the block, which
can be the whole page when the toggle sits in a header. Blocks with
nothing to focus leave focus on the toggle.

Escape closes the open toggled block that holds focus and returns focus
to a toggle that controls it. A toggle inside the block it closes also
hands focus back to the toggle outside, so focus does not land on a
hidden element.

Fixes #2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Deprecations do not inherit supports from block.json. Toggles saved by
0.4.0 or earlier that have an anchor or custom spacing failed validation
in the editor, and ones with preset colors lost them on migration. All
three deprecated saves shipped with the same supports, so declare them
once and share them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
TextControl has no description prop, so the help text for these two
fields never rendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Choosing a block without anchor support, such as Custom HTML, looked
like it worked: the selector generated an anchor and showed it. The
anchor never saved, so the toggle pointed at an ID that did not exist on
the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
classList throws on a token that contains a space. A body class such as
"is-dark mode" threw during setup and stopped every later toggle on the
page from working. Split the value into separate classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
The button text toolbar offered Link, and a link saved inside the
<button> is invalid HTML that keyboard and screen reader users trip
over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
The readme never said how to start a target hidden, and the group class
only appeared in the changelog. WordPress.org reviewers also ask where
the source for compiled JavaScript lives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
Shows the focus handoff between a toggle outside a panel and one inside
it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bcRqFEoHDKH2NkZzMRogr
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Plugin Check passed

No errors or warnings from plugin check --categories=plugin_repo.

This branch has not been deployed

No deployments
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.

Apply focus to first focusable element in toggled block

1 participant