Skip to content

Fixed block class name attribute handling - #3002

Open
girishpanchal30 wants to merge 1 commit into
developmentfrom
bugfix/2996
Open

Fixed block class name attribute handling#3002
girishpanchal30 wants to merge 1 commit into
developmentfrom
bugfix/2996

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Closes #2996

Summary

Handled the case when the className attribute of a block is an array instead of a string. This can happen when third-party plugins modify the block attributes.

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.33 KB 178.33 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 172.49 KB 172.49 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 439.82 KB 439.82 KB 0 B (0.00%)

@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for b890d1a is ready 🛎️!

@pirate-bot

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":368.65,"q50":378.92,"q75":391.98,"cnt":10}, firstPaint: {"q25":1310.18,"q50":1375.26,"q75":1542.54,"cnt":10}, domContentLoaded: {"q25":3410.43,"q50":3418.81,"q75":3438.58,"cnt":10}, loaded: {"q25":3413.4,"q50":3421.62,"q75":3441.33,"cnt":10}, firstContentfulPaint: {"q25":2217.76,"q50":2575.96,"q75":2589.09,"cnt":10}, firstBlock: {"q25":16125.24,"q50":16325.79,"q75":16375.72,"cnt":10}, type: {"q25":24.54,"q50":27.69,"q75":31.92,"cnt":10}, typeWithoutInspector: {"q25":24.58,"q50":26.32,"q75":29.35,"cnt":10}, typeWithTopToolbar: {"q25":30.18,"q50":35.71,"q75":38.18,"cnt":10}, typeContainer: {"q25":14.46,"q50":15.52,"q75":17.18,"cnt":10}, focus: {"q25":123.09,"q50":125.52,"q75":134.45,"cnt":10}, inserterOpen: {"q25":39.86,"q50":43.65,"q75":45.1,"cnt":10}, inserterSearch: {"q25":27.44,"q50":28.78,"q75":30.3,"cnt":10}, inserterHover: {"q25":4.59,"q50":5.18,"q75":5.55,"cnt":20}, loadPatterns: {"q25":1678.86,"q50":1710.75,"q75":1799.02,"cnt":10}, listViewOpen: {"q25":215.62,"q50":227.51,"q75":228.37,"cnt":10}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds safe normalization for array-valued block class names, preventing frontend rendering and asset-loading errors.

Changes:

  • Introduces shared class-name normalization.
  • Updates sticky, Font Awesome, animation, Posts Grid, and modal consumers.
  • Adds regression tests and updates the standalone CSS sandbox.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
inc/class-registration.php Adds normalization and updates asset detection.
inc/class-base-css.php Normalizes animation classes.
inc/render/class-posts-grid-block.php Safely detects tiled layouts.
inc/css/blocks/class-posts-css.php Safely evaluates tiled-style CSS.
plugins/otter-pro/inc/render/class-modal-block.php Normalizes modal wrapper classes.
tests/test-block-class-name.php Adds regression coverage.
tests/php/foreign-sabberworm-sandbox.php Loads the new dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@girishpanchal30 girishpanchal30 changed the title Fixed class name handling for blocks to support array inputs Fixed block class name attribute handling Aug 27, 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.

Sticky asset loader crashes when block className is an array

4 participants