Skip to content

Pattern Creator: Show the same categories in the inspector and submission modal - #787

Open
annezazu wants to merge 1 commit into
trunkfrom
fix/611-consistent-pattern-categories
Open

annezazu wants to merge 1 commit into
trunkfrom
fix/611-consistent-pattern-categories

Conversation

@annezazu

@annezazu annezazu commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

The inspector listed every category term, including retired ones, while the submission modal fetched without per_page and so only showed the first 10 terms. Both now read a single server-defined list of selectable category slugs, matching the categories registered by WordPress core.

I also made a few fixes to make this work:

  • Inspector: wrap the search field and list in a column Flex with a gap, as core does, so the list's negative top margin no longer overlaps the field. This looked pretty awkward before.
  • Submission modal: list categories alphabetically down each column, and use a min-height for modal steps so the full list doesn't need a scrollbar. I thought it looked better down each column rather than going back and forth.

Fixes #611.

Screenshots

Screen.Recording.2026-10-06.at.2.39.18.PM.mov

AI usage

I used Claude to help fix this and tested everything manually.

Summary by CodeRabbit

  • New Features
    • Pattern creators can choose from a curated list of available categories when editing or submitting a pattern.
  • UI Improvements
    • Category choices are displayed in a clearer two-column layout, with improved spacing and more flexible modal height.

…sion modal

The inspector listed every category term, including retired ones, while the
submission modal fetched without `per_page` and so only showed the first 10
terms. Both now read a single server-defined list of selectable category
slugs, matching the categories registered by WordPress core.

Also fixes layout issues in both category pickers:
- Inspector: wrap the search field and list in a column Flex with a gap, as
  core does, so the list's negative top margin no longer overlaps the field.
- Submission modal: list categories alphabetically down each column, and use
  a min-height for modal steps so the full list doesn't need a scrollbar.

Fixes #611.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@annezazu annezazu added [Type] Bug Something isn't working [Component] Pattern Creator Anything related to the pattern front end editor or preview labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: daf26d48-ca27-4916-8dbf-0a8d01b5dd92
📥 Commits

Reviewing files that changed from the base of the PR and between 059f7e1 and 7319825.

📒 Files selected for processing (7)
  • public_html/wp-content/plugins/pattern-creator/pattern-creator.php
  • public_html/wp-content/plugins/pattern-creator/src/components/pattern-categories-control/index.js
  • public_html/wp-content/plugins/pattern-creator/src/components/submission-modal/index.js
  • public_html/wp-content/plugins/pattern-creator/src/components/submission-modal/style.scss
  • public_html/wp-content/plugins/pattern-creator/src/hooks/test/use-pattern-categories.js
  • public_html/wp-content/plugins/pattern-creator/src/hooks/use-pattern-categories.js
  • public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The Pattern Directory now provides a curated list of selectable category slugs to the pattern creator. A shared hook filters category terms using that list, and both the inspector control and submission modal use the hook.

Changes

Pattern Category Selection

Layer / File(s) Summary
Provide selectable category slugs
public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php, public_html/wp-content/plugins/pattern-creator/pattern-creator.php
The Pattern Directory adds a filterable list of selectable category slugs. The pattern creator exposes that list in its JavaScript configuration.
Query and filter categories
public_html/wp-content/plugins/pattern-creator/src/hooks/use-pattern-categories.js, public_html/wp-content/plugins/pattern-creator/src/hooks/test/use-pattern-categories.js
The new hook queries category terms and filters them against the configured slugs. Tests cover matching terms, term order, and empty results.
Use shared categories in both interfaces
public_html/wp-content/plugins/pattern-creator/src/components/pattern-categories-control/index.js, public_html/wp-content/plugins/pattern-creator/src/components/submission-modal/index.js, public_html/wp-content/plugins/pattern-creator/src/components/submission-modal/style.scss
The inspector and submission modal use the shared hook. The modal unescapes category names and changes the category list layout to CSS columns. Its page uses a minimum height.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Pattern_Post_Type
  participant wporgBlockPattern
  participant usePatternCategories
  participant PatternCategoriesControl
  participant SubmissionModal
  Pattern_Post_Type->>wporgBlockPattern: provide selectable category slugs
  wporgBlockPattern->>usePatternCategories: supply configured slugs
  usePatternCategories->>PatternCategoriesControl: return filtered category terms
  usePatternCategories->>SubmissionModal: return filtered category terms
Loading

Suggested reviewers: obenland

Merge Risk: ⚪ Minimal · up to 73198

The inspector and submission modal now share one server-defined category list. The paging value used for the category request is handled by the plugin's existing request middleware, so both pickers receive their categories. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: the inspector and submission modal now show the same categories.
Description check ✅ Passed The description explains the problem and changes, references issue #611, includes a screenshot, and reports manual testing. It does not include a Props entry or numbered test steps, but the descriptio…
Linked Issues check ✅ Passed Issue #611 requires the inspector and submission modal to offer the same selectable categories and to exclude Featured. get_selectable_category_slugs() defines the requested 16 category slugs and ex…
Out of Scope Changes check ✅ Passed The inspector Flex layout change separates the search field and category list. The modal column layout and minimum height support display of the complete category list. These changes directly support …
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 6 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Component] Pattern Creator Anything related to the pattern front end editor or preview [Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent categories within inspector and submission modal

2 participants