Repository navigation
JITM: one slot component and one suppression helper for every dashboard - #52641
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Videopress plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 4 files.
2 files are newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
525577d to
bcdff20
Compare
Its slot carried a per-tab class modifier so the card could track the Overview (720px) and Settings (660px) columns. A page-level slot cannot track a tab-dependent column, which is what the modifier was working around, so it takes the wider of the two and the modifier goes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reverses the previous rule. The slot now sits inside each dashboard's content area, so it inherits that page's column instead of setting its own width -- Social's width rules and per-tab modifier go away entirely, and the shared style no longer fights the page. Forms reaches it through DataViews' composition, between the header row that holds the tabs and the table. Its slot is pinned flex: 0 0 auto alongside the toolbar and footer, or the blanket grow rule stretches it. Backup is unchanged: no tabs, already at the top of its content. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
It sat after the filters because both come from DataViewsHeaderRow. Moving it inside that component puts it between the two, so the tabs stay the anchor: header, tabs, message, filters, table. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Its slot lived inside the Overview tab panel, so Settings and AI Answers had no JITMs at all. It now renders once under the tab strip, which is also the only place all three tabs share. That sits outside jp-search-dashboard-wrap, the page's only padded container, so the card keeps a scoped inset. The old margin-zeroing goes: the shared style owns spacing now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The shared layout mixin dropped both the header's bottom border and its bottom padding when a page has a tabs strip. The border is the right call -- the strip's own hairline is the divider -- but removing the padding spaced those pages differently from every other dashboard. Affects the tabbed pages that include the mixin: Social, Search, My Jetpack, Newsletter, Podcast, Activity Log. Forms is unaffected; its tabs come from the DataViews header row, not `.jp-admin-page-tabs`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Forms' tab row is a DataViews toolbar, not `.jp-admin-page-tabs`, so the mixin left its header border in place and the page drew two dividers. Add `.jp-admin-page-has-tabs`, a style-free marker any page can declare, and key the rule on either class. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Protect's slot was inside the hero, so it moved with the screen and borrowed a class named after My Jetpack. It now sits under the tabs like Search and Social. Social's slot moves out of its padded content for the same reason: the container's padding stacked on the card's own margin and pushed it 24px lower than everywhere else. All four tabbed dashboards now land the card at the same place. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both opted their modernized dashboard out because it had no slot, and a fetched JITM records a view whether or not the page shows it. The slot exists now, so render it and drop the opt-out. These two are the clear half: their legacy dashboards still show JITMs, so without this the same site owner gets a different experience depending on a flag they cannot see. Activity Log, Podcast and SEO have never shown one, so those stay opted out pending JETPACK-2756. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Six files repeated why a page outside a padded container owes the card a gutter, in four phrasings. It belongs in the slot's own stylesheet, which owns that contract; the consumers' selectors already say what they do. Also drops a rotting pointer to three consumer sheets, the marker explained twice in one file, and prose restating the code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
60cc2f9 to
d0e43d4
Compare
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Forms: the card is lost on tab switch.
Fix: render the slot once, in a shell both routes share. Found by reading the code; not reproduced in a browser. — Terminator |
|
Follow-up: move the card gutter into Six pages set the same gutter on the card themselves,
Done when: at 1440px, the card rect on the six pages matches the table in the description ( — Terminator |
Forms renders the slot per route, so switching Forms and Responses dropped the card, which the JITM script places once per page load. The slot now parks #jp-admin-notices on unmount and the next slot adopts it through the DOM, since each wp-build route bundles its own copy of the component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed in 2942566. Forms has no shell that both routes share, so the fix is in Checked in a browser: the card stays at the same rect through Forms → Responses → Forms. Search and Social are unchanged across tabs. — Terminator |
Assert the untabbed branch in the Social test, so it checks what its name says without reaching past Testing Library for the id. Guard the ref instead of dereferencing it. Say in the changelog that the slot keeps the message across route changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Six pages set the same margin-inline on the card themselves. Move it behind `inset`, so a page says it sits outside the padded container instead of restating the value. The inset rule shares the base rule's specificity, so it has to come after it in the slot's own stylesheet. Backup and My Jetpack stay without it: their slot is already inside a padded body or a Col grid. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
cc's @LiamSarsfield since you're all about Boost page. The approach in Boost was considered for this ruling on the JITM, and it can stay like it is. If this is merged, then we might replace the ad hoc placement there with the new JitmSlot @ederrengifo @keoshi while any design topics of the JITM card itself is not on the scope of this PR, placement is. There are some tweaks in place so the slot behaves nicely with all the layouts, let me know what you think or if we should follow up on something |
Fixes JETPACK-2756 in part
Proposed changes
wp-build's page template hides every direct child of
#wpbody-contentexcept the app root, so a JITM printed onadmin_noticesnever shows. Five dashboards had each solved that separately, with five class names; eight showed no JITM at all. This replaces all of it with two shared pieces.JitmSlot(js-packages/components) hosts#jp-admin-noticesand puts the spacing on the card, not the container — so a slot that is always in the DOM and empty on most loads takes no space. It is a plain block-level sibling, which is what lets one component cover every layout: a dashboard chooses where, not how. A route that remounts the slot keeps its card: on unmount the slot parks the element, hidden, in<body>, and the next slot takes it back. It finds the element by id, because each wp-build route bundles its own copy of the component.JITM::suppress_foreign_admin_notices()(packages/jitm) clears other plugins' notices from a screen while keeping ours. A full-screen product dashboard needs that protection — someone else's upsell will break a dual-pane layout — butremove_all_actions( 'admin_notices' )also drops JITMs, which are a first-party channel, not someone else's notice. A screen that opted out throughjetpack_display_jitms_on_screenhas nothing registered to keep, so it stays silent. It matches callbacks by class rather than by object, becauseprepare_jitms()hooks the cached instance whileget_instance()builds a fresh one.The placement rule
The slot is the first child of whatever container owns that page's padding and column. In practice:
That is the position that costs no CSS. Anywhere else and the page immediately needs overrides to buy back the padding it lost, which is what every hand-rolled slot had been doing. The card inherits the page's own column rather than setting its own width.
Verified in a browser at 1440px on every dashboard — the card lands at the identical rect on all five tabbed ones:
[184, 201, 1224, 76][184, 201, 1224, 76][184, 201, 1224, 76][184, 201, 1232, 76][184, 201, 1224, 76][184, 201, 1224, 76][184, 153, 1224, 76][276, 176, 1040, 76]Container/ColgridMy Jetpack is the deliberate exception: its page sets a narrower grid, and the slot inherits it. Note its card also sits 24px higher than before, because the old
my-jetpack-jitm-cardclass carried amargin-topthe shared style does not. Flagging rather than burying it — if that space should come back it belongs in the shared style, for everyone.Three bugs this found
.jp-admin-page__page > :not(:first-child):not(.jetpack-footer)and forcesflex-direction: columnon its children. Forms renders the slot as a direct child of the page, so the slot itself was claimed as the middle and the CTA dropped below the text (94px tall instead of 76px). Fixed by excluding.jp-jitm-slotfrom that rule, exactly as.jetpack-footeralready is.Tabs.Panel value="overview", so Settings and AI Answers had no JITMs at all. It now renders once under the tab strip, the only place all three tabs share.Newsletter and VideoPress: opt-outs removed
Both opted their modernized dashboard out of JITMs in #52471, because the page had no slot and JITM records a view when it fetches a message, not when it shows one — so fetching without a slot logs impressions for cards nobody sees. That was correct at the time. The slot exists now, so the opt-out and its two helper methods are gone from each (44 lines each).
These two are the clear half of that group: their legacy dashboards still render
#jp-admin-noticesand still show JITMs, so leaving them opted out means the same site owner gets a different experience depending on a modernization flag they cannot see.Activity Log, Podcast and SEO stay opted out. They have no legacy dashboard with a slot, so they have never shown a JITM — restoring one there is a new product choice, not a repair. That is the single open question on JETPACK-2756, which argues the default should be "show them, and opt out on the record with a reason."
Scan
Untouched, and still on
remove_all_actions( 'admin_notices' )atpackages/scan/src/class-jetpack-scan.php:248.suppress_foreign_admin_notices()is the drop-in replacement, but Scan's dashboard is its own gated port and changing it here would widen an already large diff. Called out so it is not mistaken for covered.Boost
Checked in a browser, both its shells. Already correct, and deliberately untouched — no sense colliding with an active project for a refactor. Two optional follow-ups noted for its owner: swapping its three hand-rolled divs for
JitmSlot, and the getting-started screen having no slot (a JITM there falls back to the classic wp-admin position and floats over the Boost header).Shared layout mixin
Two changes beyond the slot.
Header padding on tabbed pages. The mixin no longer zeroes the header's bottom padding when a tab strip follows it. That spaced tabbed pages differently from the rest, so every page with the shared
.jp-admin-page-tabsstrip gets its bottom padding back: Social, Search, Protect, Newsletter, VideoPress, Scan, Podcast, SEO and Jetpack AI. Only the first five were checked in a browser..jp-admin-page-has-tabs, a style-free marker a page applies when its tab strip is not the shared.jp-admin-page-tabs. Forms' tab row is a DataViews toolbar that is already pinned and cannot take the strip's sticky/background styles, so it could not just adopt that class — and without it the mixin left its header border in place and the page drew two dividers under the header. Tabbed pages now render identically regardless of which tabs markup they use.Related product discussion/links
Does this pull request change what data or activity we track or use?
No new tracking. Worth knowing for review: JITM records a view when a message is fetched, not when it is displayed. A dashboard that fetches without a slot logs views for cards nobody sees — which is exactly why the Newsletter and VideoPress opt-outs were right until this PR, and why removing them without adding the slot would have been wrong.
Testing instructions
Automated, all run on this branch:
jetpack test php packages/backup packages/newsletter packages/videopress— pass.packages/backupis 439, up from 434; the five new cases are inAdmin_Notices_Suppression_Test.php. The Newsletter and VideoPress JITM tests are inverted rather than deleted, so they fail if someone re-adds an opt-out.jetpack test js js-packages/components packages/forms packages/search packages/publicize packages/newsletter packages/videopress— pass. Three new cases coverJitmSlot.pnpm run lint-changed,pnpm run lint-style <paths>,vendor/bin/phpcsand per-projectpnpm run typecheck— clean.Manual, on a local Docker site with a fixture mu-plugin answering the JITM fetch (so you are not waiting on wpcom targeting — use
jetpack_jitm_received_envelopeson a connected site;jetpack_pre_connection_jitmsonly fires when disconnected):admin_noticescallback in the same mu-plugin and open Backup. It must not appear, while the JITM still does.The modernized Backup dashboard needs
add_filter( 'rsm_jetpack_ui_modernization_backup', '__return_true' )(or any proxied a12s request).Screenshots