Skip to content

Search: lighter Clear Filters button + Compact block style (RSM-3507) - #48946

Merged
kangzj merged 3 commits into
trunkfrom
atlas/rsm-3507-clear-filters-button-customization
May 19, 2026
Merged

kangzj merged 3 commits into
trunkfrom
atlas/rsm-3507-clear-filters-button-customization

Conversation

@kangzj

@kangzj kangzj commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes RSM-3507

Why

On some themes the standalone Clear Filters block rendered as an oversized button with no way for an author to right-size it — it was hardcoded to the core Button block's heavy .wp-block-button wrapper + is-style-outline variation. Authors can now pick a Compact style for a slim button, while the Default keeps the theme's regular core/button look (pill on TT5, rounded on TT4, etc.) — pixel-identical to a vanilla core/button placed on the same page.

Proposed changes

  • Drop the .wp-block-button wrapper and is-style-outline style variation — those were the source of the oversized rendering. Keep wp-block-button__link on the button so it still inherits the theme's full core/button look (border-radius, hover, etc.).
  • Use a neutral <div> as the block root so the block follows theme block-layout alignment (a bare <button> root inherits wp-element-button's margin:0 and breaks out of the content column — the same reason core wraps its button in .wp-block-button).
  • Explicitly enqueue the core Button block stylesheet (wp_enqueue_style( 'wp-block-button' )) from render.php. That stylesheet is normally only auto-enqueued when a core/button is on the page; without it, our wp-block-button__link class would be inert.
  • Register two block styles — Default (theme's regular core/button look) and Compact (slim padding/font, keeps the theme's radius/colors/typography) — so authors can right-size the button without custom CSS.
  • Behavior unchanged: the label and "Hide when no filter is active" controls, the hide-when-inactive server seeding, and the actions.clearFilters interactivity binding all work as before.

Note: full typography/color/border block supports were evaluated but intentionally not shipped — for a server-rendered block they don't reliably reach the inner button without the heavy core/search render-time style plumbing, and fine-grained color/border controls are over-engineering for a utility "clear" button. The Default/Compact styles plus the pre-existing spacing (margin/padding) support cover the real need.

Screenshots

Real-screen before / after, captured at /clear-filters-test/ via local docker (Twenty Twenty-Five) at 1440×900.

Before (trunk) After
before after

Before: both buttons forced to the core Button outline variation (oversized, no theme polish). After: themed pill Default that matches the theme's regular core/button exactly, plus a visibly slim pill Compact — both correctly aligned with the content column.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Add the Clear Filters block to a page (or use the jetpack-search/clear-filters block inside a Filters group). Set "Hide when no filter is active" off so it's always visible for testing.
  • On a theme with large default buttons, confirm the block no longer renders the oversized core Button outline style.
  • Confirm the Default style renders pixel-identical to a regular core/button placed on the same page (same border-radius, colors, padding, typography).
  • In the block toolbar/inspector Styles, switch to Compact; confirm it renders a visibly slimmer button (smaller padding/font) while keeping the theme's border-radius, colors, and typography.
  • Confirm the button stays aligned with the surrounding content column (not flush to the viewport edge).
  • Try a theme that defines styles.elements.button.border.radius in theme.json (e.g. Twenty Twenty-Four = .33rem) and confirm both Default and Compact pick up that radius. Try a theme without it (e.g. Twenty Twenty-Five) and confirm both pick up core's default (pill / 9999px) so the button still looks like a regular core/button on that theme.
  • Confirm unchanged behavior: the Label field and Hide when no filter is active toggle still work; with a filter active the button appears and clicking it clears all active filters and the price range.

@kangzj kangzj added the [Status] Needs Review This PR is ready for review. label May 19, 2026
@kangzj kangzj self-assigned this May 19, 2026
@kangzj kangzj added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels May 19, 2026
@kangzj

This comment has been minimized.

@github-actions

github-actions Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the atlas/rsm-3507-clear-filters-button-customization branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack atlas/rsm-3507-clear-filters-button-customization

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@claude

This comment has been minimized.

@github-actions github-actions Bot added the [Package] Search Contains core Search functionality for Jetpack and Search plugins label May 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

The Clear Filters block hardcoded the core Button block markup
(wp-block-button is-style-outline / wp-block-button__link), so on themes
with large default buttons it rendered oversized with no author recourse.

Drop the core Button block classes for the lighter wp-element-button
baseline (matching the sibling results-load-more / active-filters
blocks), keep a neutral wrapper div as the block root so it still
follows theme block-layout alignment, and register a Compact block
style for themes whose button baseline is still too large.
@kangzj
kangzj force-pushed the atlas/rsm-3507-clear-filters-button-customization branch from 586b96d to 614dfb8 Compare May 19, 2026 05:23
@kangzj

kangzj commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Review-cycle summary — 614dfb88c73

2 round(s); CI green; claude[bot] reviewed with no blocking issues; no code changes required.

What changed during the cycle

Commits added during the cycle: none — the implementation commit needed no changes in response to review.

Branch hygiene: rebased onto fresh origin/trunk (now 0 behind).

Review threads addressed:

Source Comment Resolution
claude[bot] PR review (#4484615051) "No blocking issues. ✅" — correct, secure, backwards-compatible, consistent with sibling blocks. All notes were explicit "no change needed" observations; nothing actionable.

Unaddressed (flagged for owner): None.

CI: all required checks passing (PHP 8.3/8.4/8.5 matrix, Static analysis, Stylelint, Type checking, Storybook, Project structure).

@kangzj kangzj added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] In Progress labels May 19, 2026
@jp-launch-control

jp-launch-control Bot commented May 19, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/search/src/search-blocks/blocks/clear-filters/render.php 29/34 (85.29%) -0.42% 0 💚

Full summary · PHP report · JS report

kangzj added 2 commits May 20, 2026 09:51
Picking up wp-element-button alone got the theme's element-button
baseline (color, padding, font) but lost the styling that themes attach
to .wp-block-button__link — most visibly the border-radius (e.g. the
9999px pill in TT5, .33rem rounding in TT4), which made the button look
unlike the theme's regular core/button.

Re-add wp-block-button__link to the button class so it inherits the
theme's full core/button look. The .wp-block-button parent wrapper and
is-style-outline (the actual sources of the oversized rendering called
out in RSM-3507) stay omitted.
…dalone

The core button block's stylesheet (which defines the
:where(.wp-block-button__link) defaults — pill radius, no shadow, no
underline) is only auto-enqueued when a core/button is on the page.
Without it, our wp-block-button__link class is inert and the Clear
Filters button comes out square on themes whose theme.json doesn't set
elements.button.border.radius (e.g. TT5).

Pull the handle in explicitly from render so a page with only our block
gets the same baseline a page with a core/button would.
@kangzj
kangzj merged commit 8514af3 into trunk May 19, 2026
71 checks passed
@kangzj
kangzj deleted the atlas/rsm-3507-clear-filters-button-customization branch May 19, 2026 22:10
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Search Contains core Search functionality for Jetpack and Search plugins [Status] UI Changes Add this to PRs that change the UI so documentation can be updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant