Give the agent the existing toast helper, don’t invent a new alert div
The PR adds a fixed green <div role="alert">Saved</div> in the page component. The repo already has toast.success() from a shared helper, with a live region, a dismiss button, a queue, and a reduced-motion path. The new
The PR adds a fixed green <div role="alert">Saved</div> in the page component. The repo already has toast.success() from a shared helper, with a live region, a dismiss button, a queue, and a reduced-motion path. The new banner sits under the header, never clears, and is invisible to whatever already manages announcements.
I’ve started treating a homemade alert div as incomplete when a toast helper exists. Success and error feedback is part of the app shell, not decoration for one form.
Why the extra banner shows up
Tutorials teach “set a message state and render a div.” That works in a sandbox. In an app, you already decided how notifications are announced, stacked, and dismissed. The model will not find toast.ts unless you point at it.
A second banner also splits the contract: one path uses the helper’s role and timeout, the other is a pretty box with no way to dismiss it from the keyboard.
A simple toast policy
- User-facing success and error feedback goes through the existing helper
-
Do not add a page-local
banner/alertstate for the same job - Inline field errors stay on the field; toasts are for page-level outcomes
- A new toast variant is a helper change, with a story or example, not a one-off div
If the surface is a blocking confirmation, use the existing dialog, not a toast and not a new overlay.
What to put in the prompt
Use the existing toast helper (toast.success, toast.error) for page-level feedback.
Do not add a fixed alert div or a local banner state.
Keep inline field errors on the form.
If you need a new toast variant, add it next to the helper and show one example; do not invent a banner in this page.
Paste the helper’s public API and one call site. In review, search the diff for role="alert", role="status", and a fixed or absolute banner outside the toast root.
Reject / send back
Reject
- A page-local success banner that duplicates the toast
- A toast implemented with
alert()or a comment saying “TODO: hook up notifications” - A new toast library added for one message
- A banner with no dismiss path and no live region
Accept
- A mutation that calls the existing helper on success and failure
- Inline errors for field validation, plus a toast only for the page-level outcome
- A helper change that adds a variant used by the new call site
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.