Skip to content

[MOOSE-408] Dedupe class tokens in getBaseClassName to avoid duplicated classes - #371

Open
spadilha wants to merge 4 commits into
mainfrom
fix/MOOSE-408/dedupe-class-tokens-in-getbaseclassname
Open

[MOOSE-408] Dedupe class tokens in getBaseClassName to avoid duplicated classes#371
spadilha wants to merge 4 commits into
mainfrom
fix/MOOSE-408/dedupe-class-tokens-in-getbaseclassname

Conversation

@spadilha

@spadilha spadilha commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What does this do/fix?

This pull request fixes an issue in the create-wp-controls.js utility where CSS classes were being duplicated in the output of getBaseClassName when propsClassName already included attributeClassName or attributeClasses. The logic now deduplicates class tokens across all three sources to prevent redundant classes.

Bug fix:

  • Updated getBaseClassName in create-wp-controls.js to deduplicate class name tokens across propsClassName, attributeClassName, and attributeClasses, ensuring no duplicate classes are output.
  • Documented the fix in the CHANGELOG.md under 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

  • I've added a changelog entry for these changes.
  • I've linked to a relevant Jira issue.

@spadilha
spadilha requested a review from GeoffDusome July 22, 2026 23:06
@spadilha spadilha self-assigned this Jul 22, 2026
@spadilha
spadilha marked this pull request as ready for review July 22, 2026 23:06
@spadilha
spadilha requested review from Copilot and dpellenwood July 22, 2026 23:07

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

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, and attributeClasses in getBaseClassName.
  • 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.

@spadilha spadilha added Launch Environment Deploys to dokku In QA Waiting on QA labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In QA Waiting on QA Launch Environment Deploys to dokku

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants