Repository navigation
✨ dashboard: toasts show a countdown bar timed to their auto-dismiss - #15231
Conversation
Every timed toast (success/info/warning, error with an explicit deadline, and an in-flight toast resolved by dismissToast) now carries a 2px .toast-bar along its bottom edge that drains from full to empty over the same milliseconds the dismiss timer uses: toastCountdownBar arms both the setTimeout and the bar's inline animation-duration from one value. Sticky (error) and persistent (spinner) toasts show no bar. The bar is absolutely positioned (no layout shift), takes the severity token at reduced opacity, is clipped to the toast radius, and is hidden under prefers-reduced-motion. Fixes #15230 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
|
Another agent tried to open a PR from |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Read the three timed-toast paths in index.html at this head. The bar and the dismiss timer are armed from one ms in toastCountdownBar (index.html:39790-39797), the persistent spinner branch keeps its TOAST_PROGRESS_MAX_MS safety timeout without a bar (:39817-39823), sticky errors only get a bar when autoDismissMs > 0 (:39830), and dismissToast(el, newMsg) sets textContent before appending the bar (:39857 then :39863), so the rewrite does not wipe it. Looks correct to me.
One side effect worth stating in the body, since the diff hides it: .toast previously had no position, so the absolutely-positioned .toast-close (index.html:3522, top:4px; right:8px) was anchored to the nearest positioned ancestor — #toast-container, which is position: fixed (:3490) — i.e. every sticky toast's × rendered at the container's corner, not its own. The new position: relative on .toast (:3499) moves the × into each toast. That is almost certainly an improvement, and overflow: hidden does not clip it at those offsets, but it is a visible change for stacked sticky errors that the title and changelog do not mention.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Fixes #15230
Every timed toast now draws a 2px countdown bar along its bottom edge that drains from full to empty over exactly its auto-dismiss window.
How the duration is wired: a new
toastCountdownBar(el, ms, onExpire)helper creates the.toast-barspan, setsstyle.animationDuration = ms + 'ms'inline, and arms the singlesetTimeout(onExpire, ms)— so the bar and the dismiss timer always share one value.showToastroutes the default (TOAST_DURATION_MS), the explicitautoDismissMs(e.g. the 10 s layout-reset undo), and the error-with-deadline paths through it;dismissToast(el, newMsg)(in-flight toast → result) does too. Sticky errors and persistent spinner toasts never call it and show no bar.CSS:
.toastgainsposition: relative; overflow: hidden(clips the bar to the toast radius; no size/layout change).@keyframes toast-bar-drainscales X 1→0 linearly; severity colour via--green/--red/--blue/--status-warnat 0.55 opacity; hidden underprefers-reduced-motion.Tests:
TestToastCountdownBarWiredToDismissTimerasserts the helper, every timed path inshowToast/dismissToast, the absence on persistent toasts, and the CSS.Verified in headless Chrome with a standalone harness: bars on timed toasts only, severity-coloured, none on sticky/persistent.