Skip to content

fix(web-preview): right-align toolbar close button#4740

Open
adekbadek wants to merge 1 commit into
releasefrom
hotfix/web-preview-toolbar-right-alignment
Open

fix(web-preview): right-align toolbar close button#4740
adekbadek wants to merge 1 commit into
releasefrom
hotfix/web-preview-toolbar-right-alignment

Conversation

@adekbadek
Copy link
Copy Markdown
Member

Changes proposed in this Pull Request:

Hotfix targeting release.

.newspack-web-preview__toolbar-right uses display: grid; grid-template-columns: repeat(2, 1fr). When no title prop is passed to <WebPreview> (e.g. the Newspack Campaigns prompt preview), the toolbar has only one flex child and the two 1fr columns end up spreading the device-size dropdown and the close button across the full width of the toolbar – the close button is no longer right-aligned next to the device dropdown.

Switch the layout to display: flex; justify-content: flex-end so the two buttons always cluster together on the right edge, regardless of whether a title is rendered.

How to test the changes in this Pull Request:

Tested locally on the components demo page (/wp-admin/admin.php?page=newspack-components-demo, the "Web Previews" section, which has one <WebPreview> with title and one without):

Case Result
Without title (Campaigns prompt preview case) Device dropdown and close button cluster on the right edge of the toolbar
With title (Segments / Prompts wizard case) Title left, buttons right

Steps:

  1. n build newspack-plugin
  2. Visit /wp-admin/admin.php?page=newspack-components-demo
  3. Scroll to the "Web Previews" card and click each "Preview Newspack Site" trigger.
  4. Confirm in both modals the device-size icon and close X sit together at the right edge.

Other information:

  • CSS-only change in packages/components/src/web-preview/style.scss (1 file, +2 / -3).
  • Affects every consumer of WebPreview from newspack-components (newspack-popups, newspack-newsletters, newspack-ads, newspack-multibranded-site, newspack-block-theme, newspack-manager, newspack-listings). Layout is backwards compatible.
  • Supersedes fix(web-preview): right-align toolbar close button #4734 (which was opened against trunk by mistake).

Use flex with flex-end so the device size and close buttons cluster
at the right edge instead of stretching across the toolbar when no
title is set (e.g. the campaigns prompt preview).
@adekbadek adekbadek requested a review from a team as a code owner May 18, 2026 17:01
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 6.39.5-hotfix-web-preview-toolbar-right-alignment.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant