: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(insights): drop two failed attempts at the scene title drag fault (#95564)
Paul D'Ambraaf14abda537a
diff --git a/frontend/src/layout/scenes/components/SceneTitleSection.test.tsx b/frontend/src/layout/scenes/components/SceneTitleSection.test.tsxindex e0567571ff00..882e497bfd67 100644--- a/frontend/src/layout/scenes/components/SceneTitleSection.test.tsx+++ b/frontend/src/layout/scenes/components/SceneTitleSection.test.tsx@@ -1,6 +1,6 @@import '@testing-library/jest-dom'-import { cleanup, createEvent, fireEvent, render, screen } from '@testing-library/react'+import { cleanup, fireEvent, render, screen } from '@testing-library/react'import { SceneName } from './SceneTitleSection'@@ -37,32 +37,4 @@ describe('SceneName', () => {rerender(<SceneName name="Generated name" canEdit onChange={jest.fn()} />)expect(screen.getByText('Generated name')).toBeInTheDocument()})-- // Guards click and drag text selection: the edit row is wider and taller than the field- // inside it, so a press that misses the glyphs by a few pixels lands on the row. Left- // unclaimed, some browsers read that press as their own gesture rather than a selection.- test('a press on the edit row beside the field focuses the field and is consumed', () => {- render(<SceneName name="Paying users" canEdit forceEdit onChange={jest.fn()} />)-- const row = screen.getByTestId('scene-name-edit-row')- const textarea = screen.getByRole('textbox')- expect(textarea).not.toHaveFocus()-- const press = createEvent.mouseDown(row)- fireEvent(row, press)-- expect(textarea).toHaveFocus()- expect(press.defaultPrevented).toBe(true)- })-- // The counterpart: a press on the field itself must reach the browser untouched,- // or it would never start a selection.- test('a press on the field itself is left alone', () => {- render(<SceneName name="Paying users" canEdit forceEdit onChange={jest.fn()} />)-- const press = createEvent.mouseDown(screen.getByRole('textbox'))- fireEvent(screen.getByRole('textbox'), press)-- expect(press.defaultPrevented).toBe(false)- })})diff --git a/frontend/src/layout/scenes/components/SceneTitleSection.tsx b/frontend/src/layout/scenes/components/SceneTitleSection.tsxindex 26cb54ff583a..4662a56bad53 100644--- a/frontend/src/layout/scenes/components/SceneTitleSection.tsx+++ b/frontend/src/layout/scenes/components/SceneTitleSection.tsx@@ -469,7 +469,6 @@ export function SceneName({const [isEditing, setIsEditing] = useState(forceEdit)const containerRef = useRef<HTMLDivElement>(null)- const nameInputRef = useRef<HTMLTextAreaElement>(null)const textClasses ='text-lg font-semibold my-0 pl-[var(--button-padding-x-sm)] min-h-[var(--button-height-sm)] leading-[1.4] select-auto'@@ -520,21 +519,8 @@ export function SceneName({onChange && canEdit ? (<>{isEditing ? (- <div- ref={containerRef}- className="flex items-center gap-1 w-full"- data-attr="scene-name-edit-row"- onMouseDown={(e) => {- // A press on the row around the field leaves the gesture unclaimed by the page,- // which some browsers read as a window drag instead of a text selection.- if (e.target === e.currentTarget) {- e.preventDefault()- nameInputRef.current?.focus()- }- }}- >+ <div ref={containerRef} className="flex items-center gap-1 w-full" data-attr="scene-name-edit-row"><TextareaPrimitive- ref={nameInputRef}variant="default"name="name"value={name || ''}diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex 24b3a52520e0..99809f5b3f9b 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -2165,11 +2165,3 @@transform: translateY(0);}}--// `-webkit-app-region` is an inherited property in Chromium, and a region marked as a drag-// handle swallows click and drag text selection. Text entry must never become a drag handle.-input,-textarea,-[contenteditable='true'] {- -webkit-app-region: no-drag;-}