[MOOSE-408] Dedupe class tokens in getBaseClassName to avoid duplicated classes - #371
Open
spadilha wants to merge 4 commits into
Open
[MOOSE-408] Dedupe class tokens in getBaseClassName to avoid duplicated classes#371spadilha wants to merge 4 commits into
spadilha wants to merge 4 commits into
Conversation
…ted classes when sources overlap
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes duplicated CSS classes produced by getBaseClassName in the block controls utility by deduplicating class tokens across multiple class sources, and documents the fix in the changelog.
Changes:
- Deduplicate class name tokens across
propsClassName,attributeClassName, andattributeClassesingetBaseClassName. - Add a 2026.07 changelog entry referencing MOOSE-408.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| wp-content/themes/core/assets/js/utils/create-wp-controls.js | Updates getBaseClassName to split into tokens and dedupe via Set before returning the merged class string. |
| CHANGELOG.md | Documents the fix under the new 2026.07 entry with a link to MOOSE-408. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GeoffDusome
approved these changes
Jul 23, 2026
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.
What does this do/fix?
This pull request fixes an issue in the
create-wp-controls.jsutility where CSS classes were being duplicated in the output ofgetBaseClassNamewhenpropsClassNamealready includedattributeClassNameorattributeClasses. The logic now deduplicates class tokens across all three sources to prevent redundant classes.Bug fix:
getBaseClassNameincreate-wp-controls.jsto deduplicate class name tokens acrosspropsClassName,attributeClassName, andattributeClasses, ensuring no duplicate classes are output.CHANGELOG.mdunder version 2026.07, referencing MOOSE-408.Note: on the live front-end this is largely masked because WordPress's server-side layout support re-serializes the class attribute via WP_HTML_Tag_Processor (which treats classes as a set), but the duplication is still present in stored post_content.
QA
Links to relevant issues
Pull request checklist