Repository navigation
Fix Accordion letter spacing lost after reopening the post - #3126
Merged
Merged
Conversation
The letterSpacing attribute was declared as a string while the Letter Spacing range control saves a number, so the editor discarded the saved value on load and the next save removed it. Accept both types, as the Advanced Heading block already does. Closes #3124 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WPwFxvA5VPq8sd4EzsNFFA
Contributor
Bundle Size Diff
|
Contributor
|
Plugin build for 864873b is ready 🛎️!
|
Contributor
E2E TestsPlaywright Test Status: See serial and parallel matrix jobs Performance ResultsserverResponse: {"q25":509.09,"q50":514.41,"q75":526.94,"cnt":10}, firstPaint: {"q25":1522.51,"q50":1666.76,"q75":2031.49,"cnt":10}, domContentLoaded: {"q25":4348.38,"q50":4397.95,"q75":4431.66,"cnt":10}, loaded: {"q25":4351.83,"q50":4401.97,"q75":4434.99,"cnt":10}, firstContentfulPaint: {"q25":2301.58,"q50":3232.45,"q75":3295.92,"cnt":10}, firstBlock: {"q25":20268.87,"q50":20336.2,"q75":20559.82,"cnt":10}, type: {"q25":32.45,"q50":35,"q75":39.25,"cnt":10}, typeWithoutInspector: {"q25":32.52,"q50":36.98,"q75":41,"cnt":10}, typeWithTopToolbar: {"q25":39.01,"q50":43.91,"q75":47.2,"cnt":10}, typeContainer: {"q25":18.92,"q50":20.46,"q75":20.89,"cnt":10}, focus: {"q25":166.21,"q50":176.89,"q75":196.73,"cnt":10}, inserterOpen: {"q25":50.48,"q50":56.66,"q75":60.66,"cnt":10}, inserterSearch: {"q25":35.06,"q50":36.3,"q75":37.3,"cnt":10}, inserterHover: {"q25":5.8,"q50":6.28,"q75":6.92,"cnt":20}, loadPatterns: {"q25":2192.82,"q50":2224.82,"q75":2307.74,"cnt":10}, listViewOpen: {"q25":289.01,"q50":311.02,"q75":319.55,"cnt":10} |
pirate-bot
approved these changes
Oct 20, 2026
Contributor
There was a problem hiding this comment.
🟢 Approved
The fix keeps Accordion letter spacing after reload, and the new test fails without it.
Validation details
- Files reviewed: 2/2 changed files.
- The new E2E test passes at HEAD on WordPress 7.1.3 and PHP 8.3:
cd /repo && export WP_BASE_URL=http://localhost:8080 WP_USERNAME=admin WP_PASSWORD=admin; set -o pipefail; timeout 280 n…printedkeeps letter spacing after the post is reopened(run R10) - With the old
stringtype, the same test fails on its assertion:ln -sfn /workspace/checks/R1/base /var/www/html/wp-content/plugins/otter-blocks && cd /workspace/checks/R1/base && expor…printedReceived: undefined(run R13) - The saved post's front end has
letter-spacing:3pxon the item titlescd /repo && wp post list --post_type=post --post_status=publish --orderby=ID --order=DESC --fields=ID,post_name --format…(run R11, exit 0). - Consumers treat
letterSpacingas a number, and Advanced Heading uses the same type list. - Question: the PR names a WordPress 6.2 floor, but
readme.txtsays 6.6. Array types work at 6.6.
Untested areas
- The second save after another setting change was checked from source only.
- Playwright ran with a local config without wp-env.
🤖 Automated review · run code-review-agent_6ad77714c2d949.22955786.
🤖 Review agent — review posted ✅ on 864873be · approved · 0 findings · 15 min
Run code-review-agent_6ad77714c2d949.22955786 · trail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Marius · project thread
Closes #3124.
Summary
Before: the Accordion's Letter Spacing (Style → Typography) was saved, but when the post was reopened the control was empty, and the next save removed the spacing from the page.
After: the value is still there after reopening the post, and the front end keeps
letter-spacing: 3px.The
letterSpacingattribute inaccordion/group/block.jsonwas declared asstring, while the RangeControl,edit.js, the types file andclass-accordion-css.phpall treat it as a number. The block parser drops attribute values whose type does not match, so the saved"letterSpacing":3was discarded on load.How: the attribute now accepts
["number", "string"], the same declaration Advanced Heading uses for its typography attributes. Acceptingstringtoo keeps any value already stored as a string. No markup, deprecation or UI change.Screenshots
None: no visual change.
Test instructions
"letterSpacing":3and the front end hasletter-spacing:3pxon the item titles.Verification
Accordion Block › keeps letter spacing after the post is reopened, on the oldstringtypeaccordion.spec.js+heading.spec.js(8 tests), local WordPress 7.1.3 / PHP 8.2…accordion-item__title>*{letter-spacing:3px}npm run test:unitNot proven: PHPUnit was not run (no PHP change); not checked on the WordPress 6.2 floor, though array attribute types have been supported since well before it.
Checklist before the final review
Generated by Claude Code