Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(quill): let people select the text in a toast (#86284)

Alessandro Pogliaghicce713ab0cee
diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.md
index 65073b5bf8d6..b78b7da6add2 100644
--- a/packages/quill/packages/primitives/AGENTS.md
+++ b/packages/quill/packages/primitives/AGENTS.md
@@ -1095,6 +1095,9 @@ toast.dismiss(id)
toast({ title: 'Item archived', action: { label: 'Undo', onClick: () => restore() } })
```
+The title and description are selectable, so a user can copy an error message out of a toast, while the rest of the card is not, so a drag across it still reads as swipe-to-dismiss.
+Custom content you put inside a `ToastCard` needs `data-base-ui-swipe-ignore` for the same treatment, or Base UI takes a drag on it as a swipe and suppresses the selection.
+
`anchoredToast` positions a toast next to an element instead of stacking it in the corner. It takes the same
options plus an anchor. An anchored toast with an action also gets a close button, so give it `timeout: 0`
when the user needs time to decide:
diff --git a/packages/quill/packages/primitives/src/toast.css b/packages/quill/packages/primitives/src/toast.css
index 0be3ef93ebee..e579d01062ef 100644
--- a/packages/quill/packages/primitives/src/toast.css
+++ b/packages/quill/packages/primitives/src/toast.css
@@ -14,6 +14,15 @@
box-shadow: var(--shadow-md);
}
+ /* The card is unselectable so a drag across it reads as a swipe-to-dismiss. The message itself
+ opts back in, and carries data-base-ui-swipe-ignore so a drag there starts a selection
+ instead of a swipe. */
+ .quill-toast-card__title,
+ .quill-toast-card__description {
+ cursor: text;
+ user-select: text;
+ }
+
.quill-toast-card__title {
font-size: var(--text-xs, 0.75rem);
font-weight: 500;
diff --git a/packages/quill/packages/primitives/src/toast.tsx b/packages/quill/packages/primitives/src/toast.tsx
index 5b630c9a16f9..031cb7b7c1df 100644
--- a/packages/quill/packages/primitives/src/toast.tsx
+++ b/packages/quill/packages/primitives/src/toast.tsx
@@ -76,8 +76,16 @@ const ToastCard = React.forwardRef<HTMLDivElement, ToastCardProps>(
</span>
)}
<div className="flex-1 min-w-0">
- {toastTitle && <div className="quill-toast-card__title">{toastTitle}</div>}
- {toastDescription && <div className="quill-toast-card__description">{toastDescription}</div>}
+ {toastTitle && (
+ <div className="quill-toast-card__title" data-base-ui-swipe-ignore>
+ {toastTitle}
+ </div>
+ )}
+ {toastDescription && (
+ <div className="quill-toast-card__description" data-base-ui-swipe-ignore>
+ {toastDescription}
+ </div>
+ )}
</div>
</div>
{action && (
diff --git a/products/desktop/packages/ui/src/styles/globals.css b/products/desktop/packages/ui/src/styles/globals.css
index 0b7a55adecff..c31187652a34 100644
--- a/products/desktop/packages/ui/src/styles/globals.css
+++ b/products/desktop/packages/ui/src/styles/globals.css
@@ -1418,6 +1418,18 @@ button,
word-break: break-word;
}
+/*
+ * @posthog/quill toast — the pinned version sets `user-select: none` on the whole card, so an
+ * error message cannot be selected and copied out of the app at all. Quill carries the same rule
+ * now, plus `data-base-ui-swipe-ignore` on the message so a drag there selects instead of swiping
+ * the toast away, which CSS alone cannot do. Drop this block once the catalog version ships it.
+ */
+.quill-toast-card__title,
+.quill-toast-card__description {
+ cursor: text;
+ user-select: text;
+}
+
/*
* @posthog/quill Dialog — make the backdrop visible against this app's
* dark theme (Quill defaults to opacity-20/dark:opacity-70 which barely