Repository navigation
Search: lighter Clear Filters button + Compact block style (RSM-3507) - #48946
Conversation
This comment has been minimized.
This comment has been minimized.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
This comment has been minimized.
This comment has been minimized.
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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.
586b96d to
614dfb8
Compare
🤖 Review-cycle summary —
|
| 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).
Code Coverage SummaryCoverage changed in 1 file.
|
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.
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-buttonwrapper +is-style-outlinevariation. Authors can now pick a Compact style for a slim button, while the Default keeps the theme's regularcore/buttonlook (pill on TT5, rounded on TT4, etc.) — pixel-identical to a vanillacore/buttonplaced on the same page.Proposed changes
.wp-block-buttonwrapper andis-style-outlinestyle variation — those were the source of the oversized rendering. Keepwp-block-button__linkon the button so it still inherits the theme's full core/button look (border-radius, hover, etc.).<div>as the block root so the block follows theme block-layout alignment (a bare<button>root inheritswp-element-button'smargin:0and breaks out of the content column — the same reason core wraps its button in.wp-block-button).wp_enqueue_style( 'wp-block-button' )) fromrender.php. That stylesheet is normally only auto-enqueued when acore/buttonis on the page; without it, ourwp-block-button__linkclass would be inert.labeland "Hide when no filter is active" controls, the hide-when-inactive server seeding, and theactions.clearFiltersinteractivity 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: both buttons forced to the core Button outline variation (oversized, no theme polish). After: themed pill Default that matches the theme's regular
core/buttonexactly, 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
jetpack-search/clear-filtersblock inside a Filters group). Set "Hide when no filter is active" off so it's always visible for testing.core/buttonplaced on the same page (same border-radius, colors, padding, typography).styles.elements.button.border.radiusintheme.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 regularcore/buttonon that theme.