Skip to content

feat: let toast actions render as links - #12

Open
anmolsinghbhatia wants to merge 1 commit into
mainfrom
feat/toast-action-link-semantics
Open

feat: let toast actions render as links#12
anmolsinghbhatia wants to merge 1 commit into
mainfrom
feat/toast-action-link-semantics

Conversation

@anmolsinghbhatia

Copy link
Copy Markdown
Contributor

Description

ToastData's actions and primaryAction now take an optional href (and target), so a toast action that is a genuine navigation target renders as an <a> rather than a <button>. It keeps middle-click, cmd/ctrl-click, right-click → "Copy link address" and the status-bar URL preview, and reaches the accessibility tree as a link. The action is still declared as data, so the closed API holds and the styling is unchanged — a link and a button action are visually identical.

target="_blank" derives its own rel="noopener noreferrer"; callers never pass a rel.

Type of Change

  • Improvement

Screenshots

Screen.Recording.2026-09-01.at.7.45.56.PM.mov

`ToastData`'s `actions` and `primaryAction` take an optional `href` (and
`target`), so an action that is a genuine navigation target renders as an
`<a>` rather than a `<button>`. It keeps middle-click, cmd/ctrl-click,
right-click -> "Copy link address" and the status-bar URL preview, and
reaches the accessibility tree as a link. The action is still declared as
data, so the closed API holds and the styling stays on-token.

A link action renders the styled part directly instead of grafting Base
UI's `Toast.Action` onto it: that part's `useButton` stamps
`type="button"` or `role="button"` onto whatever it renders, either of
which would announce the anchor as a button. It contributes no focus
management to lose. `target="_blank"` derives its own
`rel="noopener noreferrer"`.
@anmolsinghbhatia anmolsinghbhatia self-assigned this Sep 1, 2026
Comment thread packages/propel/src/components/toast/toast.tsx
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.

2 participants