Repository navigation
feat(follow): read Get alerts and keep the button's width steady - #348
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Self-review summary: four rounds on this branch before handoff. Accepted:
Declined:
Deferred (not blocking)
|
…creen readers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thomasguillot
marked this pull request as ready for review
November 27, 2026 16:27
Contributor
|
Hey @thomasguillot, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Follow Coverage button changed width when a reader followed, gave no sign it was working, hid how to stop alerts, and said "Follow", which on a news site can read as following on social media or needing an account. This makes it say what it does, keeps it the same width, and confirms what the reader signed up for.
What changes
The button now reads Get alerts, then Alerts on with a check. Pointing at Alerts on, or tabbing to it, shows Stop alerts. "Stop alerts" replaces the issue's "Turn off" after newsroom feedback: a reader who comes back later still knows what it stops. The block keeps its name, Follow Coverage.
With this change:
The block README, DEVELOPMENT notes and the docs site pages are updated, and the three docs screenshots that show the button are retaken.
Closes #345.
How to test
Technical details
Entry_Bindings::show_follow_labels()wraps the button's text in three labels stacked in one grid cell: the publisher's text, "Alerts on" with core'score/checkicon, and "Stop alerts" (aria-hidden), plus a spinner. The newstyle.scss(the block'sstyle) shows the right one fromaria-pressedandaria-busy, so the button takes the width of the longest. "Alerts on" stays in the accessibility tree at zero opacity under hover and focus, so the name stays "Alerts on" with the pressed state.hidden, so a page without the stylesheet reads only the publisher's label. The stylesheet overrideshiddenwith a scoped!important, which also beats theme resets like[hidden] { display: none !important }.data-on-notice/data-off-notice("Alerts on" / "Alerts off") anddata-on-message/data-off-message(the sentence with the liveblog's name in quotes) are built server-side;data-label-followingis gone.view.tsusesaria-busyandaria-disabledinstead ofdisabled, so keyboard focus stays on the button while it waits. The outcome waits forMIN_PENDING_MS(1 second) and reaches every button for the same liveblog, including ones that arrived mid-toggle.permissionChange, so the permission is also read shortly afterrequestPermission()resolves, from OneSignal or the browser's ownNotification.permission.getSnackbar()helper, which the Share block now uses too. Newspack UI announces a notice as it opens it, so the notice opens with the full sentence; on a page with one liveblog it then shows the short text, keeping the sentence asscreen-reader-text. Errors go to its error snackbar. Without Newspack UI, success goes to a visually hidden live region added when the toggle starts, and errors to the existing message after the button.Coverage_Follow_Block::should_render()returns false in feeds, and the block's stylesheet joins the list preloaded for polled entries.tests/js/follow-button.test.ts(spinner timing, buttons sharing a liveblog, confirmations, the prompt outcomes, failures) andtest_button_holds_its_labels_and_names_the_liveblog/test_renders_nothing_in_a_feedin PHPUnit. Jest 234 passed, PHPUnit 1560 passed, PHPCS, Stylelint and the typecheck clean, docs site checks pass.Self-review: three rounds (Opus 5.5), no blockers.