Skip to content

feat(newspack-ui): refactor newsletter signup form with Newspack UI utilities#4491

Open
thomasguillot wants to merge 19 commits intotrunkfrom
update/reader-activation-newsletters-list
Open

feat(newspack-ui): refactor newsletter signup form with Newspack UI utilities#4491
thomasguillot wants to merge 19 commits intotrunkfrom
update/reader-activation-newsletters-list

Conversation

@thomasguillot
Copy link
Copy Markdown
Contributor

@thomasguillot thomasguillot commented Feb 16, 2026

Changes proposed in this Pull Request:

Refactors the reader activation newsletter signup form to use Newspack UI utility classes, and adds the missing utilities needed to support it.

New Newspack UI utilities:

  • Position utility classes (position-relative, position-absolute, etc.)
  • Visibility utility classes (hidden, overflow-hidden)
  • Gradient divider component (newspack-ui__gradient-divider) with matching color tokens
  • New icons: arrowLeft, chevronDown, chevronDownSmall, chevronRight

Newsletter signup form refactor (class-reader-activation.php):

  • Layout now uses newspack-ui__stack (vertical) with gap utilities instead of custom CSS
  • Gradient divider replaces the CSS pseudo-element ::before trick for the truncated list fade
  • "See all" button uses the new chevronDownSmall icon
  • Improved accessibility: aria-label on the see-all button, aria-hidden on the decorative icon span
  • <span class="email"> replaced with <strong class="email"> (JS selector updated accordingly)
  • Removed component-specific margin overrides now covered by stack layout

UI demo page (class-newspack-ui.php):

  • Added a full newsletter signup form demo with sample data

How to test the changes in this Pull Request:

  1. Make sure you have multiple newsletters configured on your site
  2. Go through the reader registration flow and verify the newsletter signup step looks correct
  3. If there are more newsletters than the default visible count, verify the "See all" button appears and reveals the rest on click, hiding the gradient divider
  4. Visit ?ui-demo and check the new "Newsletters Signup Form" section
  5. Test in My Account — verify spacing is correct in the navigation, profile, and payment sections

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@thomasguillot thomasguillot requested a review from a team as a code owner February 16, 2026 15:01
@thomasguillot thomasguillot added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 16, 2026
@dkoo dkoo requested a review from Copilot February 20, 2026 00:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the newsletter signup form UI with several improvements to spacing, layout, and component organization. The changes introduce new utility classes and components to create a more maintainable and consistent design system.

Changes:

  • Refactored spacing utilities from class-based (e.g., newspack-ui__spacing-top--16) to data-attribute-based (e.g., data-margin-top="3") for better flexibility and cleaner HTML
  • Added new utility classes for visibility (hidden, overflow-hidden) and positioning (position-absolute, position-relative, etc.)
  • Introduced a new vstack component for vertical stacking with gap-based spacing and a gradient divider component for visual fade effects
  • Enhanced newsletter signup form with improved spacing, accessibility (aria-label on "See all" button), and better visual structure using the new components

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/reader-activation-newsletters/style.scss Removed redundant CSS rules that are now handled by utility classes and components
src/reader-activation-newsletters/newsletters-form.js Updated JavaScript to hide gradient divider when "See all" is clicked
src/newspack-ui/scss/variables/_spacing.scss Added spacer-1 variable (8px) for vstack default gap
src/newspack-ui/scss/elements/misc/_visibility.scss New file with visibility utility classes (hidden, overflow-hidden)
src/newspack-ui/scss/elements/misc/_spacing.scss Refactored from BEM classes to data-attribute selectors with loop-based generation
src/newspack-ui/scss/elements/misc/_position.scss New file with position utility classes for all CSS position values
src/newspack-ui/scss/elements/misc/_index.scss Added imports for position and visibility utilities
src/newspack-ui/scss/elements/misc/_dividers.scss Added gradient-divider component with absolute positioning
src/newspack-ui/scss/elements/_layout.scss Added vstack component for vertical flex layouts with gap spacing
includes/reader-activation/class-reader-activation.php Refactored newsletter form HTML to use new utility classes and components
includes/plugins/woocommerce/my-account/templates/v1/payment-information.php Updated to use new data-attribute spacing utilities
includes/plugins/woocommerce/my-account/templates/v1/navigation.php Updated to use new data-attribute spacing utilities
includes/plugins/woocommerce/my-account/templates/v1/account-settings.php Updated to use new data-attribute spacing utilities
includes/class-newspack-ui.php Updated demo page to showcase new newsletter form with all improvements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread includes/class-newspack-ui.php
Comment thread src/reader-activation-newsletters/newsletters-form.js Outdated
Comment thread src/reader-activation-newsletters/newsletters-form.js Outdated
Comment thread includes/class-newspack-ui.php Outdated
Comment thread src/newspack-ui/scss/elements/misc/_dividers.scss Outdated
Copy link
Copy Markdown
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new UI components and signup form look good! The only issue I'm seeing is that the "Sending to:" email address is no longer populating:

Image

I can confirm that it does populate on trunk, so something must have changed in the selector logic that populates it.

@github-actions github-actions Bot added the [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator label Feb 20, 2026
@thomasguillot
Copy link
Copy Markdown
Contributor Author

The only issue I'm seeing is that the "Sending to:" email address is no longer populating

🤦

Fixed: 4f97661

@thomasguillot thomasguillot requested a review from dkoo February 20, 2026 10:30
@thomasguillot thomasguillot removed the [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator label Feb 20, 2026
Copy link
Copy Markdown
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomasguillot sorry, this one fell off my radar. I updated the branch with trunk and it works well now.

@github-actions github-actions Bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Mar 30, 2026
@thomasguillot
Copy link
Copy Markdown
Contributor Author

Thank you @dkoo. I might wait for #4600 to be merged first because there will be a bunch of conflicting changes and I might need to rework this PR.

@thomasguillot thomasguillot added Do Not Merge! and removed [Status] Approved The pull request has been reviewed and is ready to merge labels Mar 30, 2026
@thomasguillot thomasguillot force-pushed the update/reader-activation-newsletters-list branch from c23a24a to 7550a72 Compare March 31, 2026 08:24
@thomasguillot thomasguillot changed the title feat: update reader activation newsletters list feat(newspack-ui): refactor newsletter signup form with Newspack UI utilities Mar 31, 2026
@thomasguillot thomasguillot requested a review from Copilot March 31, 2026 08:40
@thomasguillot thomasguillot added [Status] Needs Review The issue or pull request needs to be reviewed and removed Do Not Merge! labels Mar 31, 2026
@thomasguillot thomasguillot requested a review from dkoo March 31, 2026 08:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/reader-activation-newsletters/newsletters-form.js Outdated
Comment thread includes/class-newspack-ui.php Outdated
Comment thread src/newspack-ui/UTILITY_CLASSES.md Outdated
Comment thread src/newspack-ui/UTILITY_CLASSES.md Outdated
@thomasguillot
Copy link
Copy Markdown
Contributor Author

Hey @dkoo, this has been rebased on top of #4600 and is ready for another look!

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

Labels

[Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants