Skip to content

feat(follow): size the confirmation notice to its text - #349

Closed
thomasguillot wants to merge 1 commit into
trunkfrom
feat/follow-notice-fit
Closed

thomasguillot wants to merge 1 commit into
trunkfrom
feat/follow-notice-fit

Conversation

@thomasguillot

Copy link
Copy Markdown
Contributor

"Alerts on" sat in a full-width box, which looked oversized for two words.

What changes

The Follow Coverage button now asks Newspack UI to size its confirmation notice to its text. It takes effect once sites run the newspack-plugin release that adds the option (DSGNEWS-299). Older Newspack UI versions ignore it, so nothing breaks in the meantime.

With this change:

  • On a page with one liveblog, the notice is as wide as "Alerts on" or "Alerts off".
  • On a page with several liveblogs, the full sentence shows, capped at the usual width.
  • Error notices are unchanged.

Ref DSGNEWS-299.

How to test

  1. With the newspack-plugin change in place, open a page with a Follow Coverage button for one liveblog.
  2. Turn alerts on. The notice is sized to "Alerts on" rather than the full-width box.
  3. Turn alerts off. The notice is sized to "Alerts off".
  4. On a page with buttons for several liveblogs, turn alerts on. The full sentence shows, no wider than the usual notice.
  5. Without the newspack-plugin change, repeat step 2. The notice looks as it did before.
Technical details
  • getSnackbar() in src/blocks/shared/snackbar.ts accepts an optional third options argument and passes it to createNotice only when set, so the Share block's calls are unchanged.
  • confirmToggle() calls showSnackbar( full, 'success', { fit: true } ). Error snackbars don't pass it.
  • Tests assert { fit: true } on the on and off confirmations; the existing error assertions already fail if a third argument is passed.
  • Ran npm run build, npm test, npm run typecheck and npm run lint:js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomasguillot

Copy link
Copy Markdown
Contributor Author

Closing: Newspack UI keeps snackbars at a fixed width, like Sonner, so there's no fit option to pass.

@thomasguillot
thomasguillot deleted the feat/follow-notice-fit branch November 27, 2026 16:41
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