Skip to content

Updated block validation integration#68

Merged
dknauss merged 3 commits into
dknauss:mainfrom
troychaplin:main
Jul 12, 2026
Merged

Updated block validation integration#68
dknauss merged 3 commits into
dknauss:mainfrom
troychaplin:main

Conversation

@troychaplin

@troychaplin troychaplin commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

What changed?

  • PHP registration — replaced $registry->register_check() (v3 registry object, now gone) with ba11yc_register_block_check(). Added required namespace key, replaced type with level + configurable, removed $registry parameter from the ba11yc_ready callback.
  • Two missing checks recovered — raw_url_link_text and all_metadata_disabled existed only in the window.BlockAccessibilityChecks path (removed in v4). Ported their validation logic into src/validation.js and added PHP registrations so they're no longer silently dropped.
  • JS filter renamed — addFilter('ba11yc_validate_block', ...) → addFilter('ba11yc.validateBlock', ...). The old underscore form fails silently in v4; this was the root cause of validation never running.
    window.BlockAccessibilityChecks path removed — src/lib/block-accessibility-checks.js gutted; the registerBACChecks() call removed from src/index.js.
  • Settings visibility — all 4 checks set to configurable: true so they appear in BAC's unified DataViews settings table under the borges-bibliography-builder namespace filter.
  • Tests updated — PHPUnit assertions rewritten for the v4 call shape; JS unit tests updated for the renamed filter and expanded to cover the 2 newly ported checks (22 tests total).

Why was this change needed?

Block Accessibility Checks v4 ships a clean-break API. This PR updates the Bibliography Builder plugin to stay compatible — no behavior changes, same 4 checks, same severity defaults.

Validation

  • npm run lint:js passes
  • npm run lint:css passes
  • npm run lint:i18n passes when source strings or translation docs change
  • npm run test passes
  • npm run build succeeds
  • Tested in the block editor (add block, paste DOI/BibTeX, verify output)

Checklist

  • Linked issue or explained why none was needed
  • No sensitive details disclosed publicly

@troychaplin

Copy link
Copy Markdown
Contributor Author

Hey @dknauss, I'm adding a playground preview to the Block Accessibility Checks plugin then releasing v4.0.0, once that is done this PR can be properly reviewed. Biggest changes are naming conventions, and how the external block integrates with the settings page, as this got a refactor to leverage DataViews.

borges-updates

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the plugin’s Block Accessibility Checks (BAC) integration to align with BAC v4’s breaking API changes, ensuring bibliography block validation runs again and previously-dropped checks are registered/validated.

Changes:

  • Migrates PHP-side BAC registration to ba11yc_register_block_check() (v4 shape) and updates related PHPUnit integration assertions.
  • Renames the JS validation filter hook to ba11yc.validateBlock and ports the two missing checks into src/validation.js.
  • Removes the legacy window.BlockAccessibilityChecks integration path and updates E2E detection accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
bibliography-builder.php Switches BAC check registration to v4 function + args shape; adds registrations for the two recovered checks.
src/validation.js Implements v4 filter-based validation and adds validation logic for recovered checks; renames hook to dot-separated form.
src/validation.test.js Updates unit tests for the new filter name and adds coverage for the recovered checks.
src/index.js Removes the v3 registerBACChecks() call path.
src/lib/block-accessibility-checks.js Removes legacy v3 window-global integration implementation (now comments only).
src/lib/block-accessibility-checks.test.js Replaces legacy integration tests with a placeholder marker test.
tests/phpunit/A11yIntegrationTest.php Updates PHPUnit integration expectations for v4 registration call shape and expanded check set.
tests/e2e/a11y.spec.js Updates BAC presence detection to use the v4 data store instead of window.BlockAccessibilityChecks.
package-lock.json Lockfile churn from dependency graph changes during the update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bibliography-builder.php
Comment thread tests/phpunit/A11yIntegrationTest.php
Comment thread src/validation.js Outdated
Comment thread src/lib/block-accessibility-checks.test.js

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Comment thread bibliography-builder.php Outdated
Comment thread src/validation.js
Comment thread tests/phpunit/A11yIntegrationTest.php Outdated
Comment thread tests/phpunit/A11yIntegrationTest.php
Comment thread src/lib/block-accessibility-checks.test.js Outdated
Comment thread bibliography-builder.php
@dknauss

dknauss commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Thanks Troy! BAC v4 is live now, and this PR is exactly the right direction for the new API — at least, my bots like it. :-)

We pushed a small maintainer follow-up to address the review items and get CI unstuck:

  • fixed PHPCS/docblock issues,
  • set the ba11yc_ready callback to accepted_args=0,
  • restored the previous heading_missing semantics so empty blocks do not also warn about headings,
  • added a test stub for ba11yc_register_block_check(), and replaced the tautological legacy test with an observable assertion.

Thanks for taking the time to wire Borges into the BAC v4 changes. 🙏

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.48649% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.01%. Comparing base (8e6f800) to head (d837648).

Files with missing lines Patch % Lines
src/validation.js 44.44% 2 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   80.80%   81.01%   +0.21%     
==========================================
  Files          44       43       -1     
  Lines        3084     3113      +29     
  Branches      523      522       -1     
==========================================
+ Hits         2492     2522      +30     
  Misses        185      185              
+ Partials      407      406       -1     

☔ View full report in Codecov by Harness.
📢 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.

@dknauss dknauss merged commit a5a5824 into dknauss:main Jul 12, 2026
16 checks passed
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.

3 participants