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.

feat(desktop): add feedback type dropdown (#103912)

Dylan Martin1598ae4bd98d
diff --git a/products/desktop/docs/FEEDBACK.md b/products/desktop/docs/FEEDBACK.md
index d5035d900ec4..1e1dd58d6317 100644
--- a/products/desktop/docs/FEEDBACK.md
+++ b/products/desktop/docs/FEEDBACK.md
@@ -2,6 +2,8 @@
People can select **Send feedback…** from the account menu, use the command menu, or press `Cmd+Shift+F` on macOS and `Ctrl+Shift+F` on other systems.
In the form, press `Cmd+Enter` or `Ctrl+Enter` to send feedback.
+Select **Bug**, **Feature**, or **General** from **Feedback type**. The default is **General**.
+The form shown before opening PostHog web does not ask for a feedback type.
The form sends one authenticated request to the Desktop feedback endpoint. The endpoint records the response in the Desktop feedback survey only after it accepts the full submission. Each response includes the current view, app version, session, and related task or folder ID when available.
diff --git a/products/desktop/packages/core/src/feedback/feedbackAttachmentService.test.ts b/products/desktop/packages/core/src/feedback/feedbackAttachmentService.test.ts
index 8e3395f26f0c..7b780dbc26ba 100644
--- a/products/desktop/packages/core/src/feedback/feedbackAttachmentService.test.ts
+++ b/products/desktop/packages/core/src/feedback/feedbackAttachmentService.test.ts
@@ -26,6 +26,7 @@ describe("FeedbackSubmissionService", () => {
service.submitFeedback({
response: "The page did not load",
source: "Generic (Leave feedback button)",
+ feedbackType: "bug",
feedbackView: "task-detail",
feedbackTaskId: "task-123",
appVersion: "1.2.3",
@@ -49,6 +50,7 @@ describe("FeedbackSubmissionService", () => {
expect(init).toMatchObject({ method: "POST" });
const form = init.body as FormData;
expect(form.get("response")).toBe("The page did not load");
+ expect(form.get("feedback_type")).toBe("bug");
expect(form.get("feedback_task_id")).toBe("task-123");
expect(form.get("app_version")).toBe("1.2.3");
const image = form.get("image_1");
diff --git a/products/desktop/packages/core/src/feedback/feedbackAttachmentService.ts b/products/desktop/packages/core/src/feedback/feedbackAttachmentService.ts
index d74e89549142..e50825916a4f 100644
--- a/products/desktop/packages/core/src/feedback/feedbackAttachmentService.ts
+++ b/products/desktop/packages/core/src/feedback/feedbackAttachmentService.ts
@@ -47,6 +47,7 @@ export class FeedbackSubmissionService implements IFeedbackSubmissionService {
const form = new FormData();
form.append("response", input.response);
form.append("source", input.source);
+ if (input.feedbackType) form.append("feedback_type", input.feedbackType);
form.append("feedback_view", input.feedbackView);
if (input.feedbackTaskId) {
form.append("feedback_task_id", input.feedbackTaskId);
diff --git a/products/desktop/packages/host-router/src/routers/feedback-context.schemas.ts b/products/desktop/packages/host-router/src/routers/feedback-context.schemas.ts
index 3cdc85cee800..688d3c061dd8 100644
--- a/products/desktop/packages/host-router/src/routers/feedback-context.schemas.ts
+++ b/products/desktop/packages/host-router/src/routers/feedback-context.schemas.ts
@@ -15,6 +15,7 @@ const feedbackImage = z.object({
export const feedbackSubmissionInput = z.object({
response: z.string().trim().min(1).max(4_000),
source: z.string().min(1).max(100),
+ feedbackType: z.enum(["bug", "feature", "general"]).optional(),
feedbackView: z.string().min(1).max(100),
feedbackTaskId: z.string().max(100).optional(),
feedbackFolderId: z.string().max(100).optional(),
diff --git a/products/desktop/packages/platform/src/feedback-context.ts b/products/desktop/packages/platform/src/feedback-context.ts
index 4f6f76ecf196..6e60336d67c4 100644
--- a/products/desktop/packages/platform/src/feedback-context.ts
+++ b/products/desktop/packages/platform/src/feedback-context.ts
@@ -6,6 +6,7 @@ export interface FeedbackImageUpload {
export interface FeedbackSubmissionInput {
response: string;
source: string;
+ feedbackType?: "bug" | "feature" | "general";
feedbackView: string;
feedbackTaskId?: string;
feedbackFolderId?: string;
diff --git a/products/desktop/packages/ui/src/features/feedback/FeedbackModal.test.tsx b/products/desktop/packages/ui/src/features/feedback/FeedbackModal.test.tsx
index 3fb05ccd764b..891ccbeea874 100644
--- a/products/desktop/packages/ui/src/features/feedback/FeedbackModal.test.tsx
+++ b/products/desktop/packages/ui/src/features/feedback/FeedbackModal.test.tsx
@@ -1,3 +1,4 @@
+import type { FeedbackSubmissionInput } from "@posthog/platform/feedback-context";
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -25,7 +26,8 @@ import { FeedbackModal, type FeedbackModalMode } from "./FeedbackModal";
const readRecentLogs = vi.fn<() => Promise<string | null>>();
const captureScreenshot = vi.fn<() => Promise<string | null>>();
-const submitFeedback = vi.fn<() => Promise<void>>();
+const submitFeedback =
+ vi.fn<(input: FeedbackSubmissionInput) => Promise<void>>();
async function renderModal(
mode: FeedbackModalMode | null,
@@ -93,6 +95,42 @@ describe("FeedbackModal", () => {
expect(screen.getByRole("dialog")).toHaveClass("ph-no-capture");
});
+ it.each([
+ { label: "Bug", value: "bug" },
+ { label: "Feature", value: "feature" },
+ { label: "General", value: "general" },
+ ])("sends the selected $label feedback type", async ({ label, value }) => {
+ const user = userEvent.setup();
+ await renderModal("feedback");
+ const selector = screen.getByRole("combobox", { name: "Feedback type" });
+ expect(screen.getByLabelText("Feedback type")).toBe(selector);
+ expect(selector).toHaveTextContent("General");
+ await user.click(selector);
+ await user.click(screen.getByRole("option", { name: label }));
+ await user.type(
+ screen.getByPlaceholderText("What happened, and what did you expect?"),
+ "Example feedback",
+ );
+ await user.click(screen.getByRole("button", { name: "Send feedback" }));
+ expect(submitFeedback).toHaveBeenCalledWith(
+ expect.objectContaining({ feedbackType: value }),
+ );
+ });
+
+ it("does not ask for a type before opening PostHog web", async () => {
+ const user = userEvent.setup();
+ await renderModal("posthog-web");
+ expect(
+ screen.queryByRole("combobox", { name: "Feedback type" }),
+ ).not.toBeInTheDocument();
+ await user.type(
+ screen.getByPlaceholderText("What are you looking for in PostHog web?"),
+ "Example feedback",
+ );
+ await user.click(screen.getByRole("button", { name: "Send feedback" }));
+ expect(submitFeedback.mock.calls[0][0]).not.toHaveProperty("feedbackType");
+ });
+
it.each([
{ mode: "posthog-web" as const, expected: "Skip", missing: "Cancel" },
{ mode: "feedback" as const, expected: "Cancel", missing: "Skip" },
@@ -145,6 +183,7 @@ describe("FeedbackModal", () => {
expect(submitFeedback).toHaveBeenCalledWith({
response: "improve search",
source: "Generic (Leave feedback button)",
+ feedbackType: "general",
feedbackView: "task-detail",
feedbackTaskId: "task-123",
sessionId: "00000000-0000-0000-0000-000000000001",
diff --git a/products/desktop/packages/ui/src/features/feedback/FeedbackModal.tsx b/products/desktop/packages/ui/src/features/feedback/FeedbackModal.tsx
index c9c66821b589..75e464972f57 100644
--- a/products/desktop/packages/ui/src/features/feedback/FeedbackModal.tsx
+++ b/products/desktop/packages/ui/src/features/feedback/FeedbackModal.tsx
@@ -1,4 +1,7 @@
-import type { IFeedbackContext } from "@posthog/platform/feedback-context";
+import type {
+ FeedbackSubmissionInput,
+ IFeedbackContext,
+} from "@posthog/platform/feedback-context";
import {
Button,
Dialog,
@@ -8,7 +11,14 @@ import {
DialogFooter,
DialogHeader,
DialogTitle,
+ Field,
+ FieldLabel,
Kbd,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
Text,
Textarea,
} from "@posthog/quill";
@@ -29,6 +39,15 @@ import type { FeedbackModalMode } from "./feedbackStore";
export type { FeedbackModalMode } from "./feedbackStore";
+const FEEDBACK_TYPES = [
+ { value: "bug", label: "Bug" },
+ { value: "feature", label: "Feature" },
+ { value: "general", label: "General" },
+] satisfies {
+ value: NonNullable<FeedbackSubmissionInput["feedbackType"]>;
+ label: string;
+}[];
+
const MODAL_COPY: Record<
FeedbackModalMode,
{ title: string; description?: string; placeholder: string }
@@ -131,6 +150,8 @@ function FeedbackModalForm({
initialScreenshot: string | null;
}) {
const [value, setValue] = useState("");
+ const [feedbackType, setFeedbackType] =
+ useState<NonNullable<FeedbackSubmissionInput["feedbackType"]>>("general");
const [view] = useState(getAppViewSnapshot);
const [submitting, setSubmitting] = useState(false);
const [attachments, setAttachments] = useState<FeedbackAttachmentsValue>({
@@ -158,6 +179,7 @@ function FeedbackModalForm({
await contextClient.submitFeedback({
response,
source: FEEDBACK_SOURCE_BY_MODE[mode],
+ ...(mode === "feedback" ? { feedbackType } : {}),
feedbackView: view.type,
...(view.taskId ? { feedbackTaskId: view.taskId } : {}),
...(view.folderId ? { feedbackFolderId: view.folderId } : {}),
@@ -192,6 +214,30 @@ function FeedbackModalForm({
<>
<DialogBody>
<div className="flex flex-col gap-3">
+ {mode === "feedback" && (
+ <Field className="gap-1">
+ <FieldLabel htmlFor="feedback-type">Feedback type</FieldLabel>
+ <Select
+ value={feedbackType}
+ items={FEEDBACK_TYPES}
+ disabled={submitting}
+ onValueChange={(next) => {
+ if (next) setFeedbackType(next);
+ }}
+ >
+ <SelectTrigger id="feedback-type" className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {FEEDBACK_TYPES.map((type) => (
+ <SelectItem key={type.value} value={type.value}>
+ {type.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ )}
<Textarea
value={value}
onChange={(event) => setValue(event.target.value)}