8000 Bug: Prevent focus error when saving insight after viewing recording · Issue #31679 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bug: Prevent focus error when saving insight after viewing recording #31679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ordehi opened this issue Apr 28, 2025 · 1 comment
Open

Bug: Prevent focus error when saving insight after viewing recording #31679

ordehi opened this issue Apr 28, 2025 · 1 comment
Labels
bug Something isn't working right feature/insights Feature Tag: Insights overall team/product-analytics

Comments

@ordehi
Copy link
Contributor
ordehi commented Apr 28, 2025

Bug Description

Bug description

TypeError in LemonTree component when saving an insight after viewing a recording. The error occurs when trying to call .focus() on a null DOM element:

TypeError: Cannot read properties of null (reading 'focus')

File: frontend/src/lib/lemon-ui/LemonTree/LemonTree.tsx

How to reproduce

  1. Create a new insight (don't save yet)
  2. Click to watch a session recording from the insight results
  3. Close the recording modal
  4. Try to save the insight
  5. Error occurs when code attempts to focus a tree element that no longer exists

Affected code:

// Multiple unsafe .focus() calls in LemonTree.tsx
element.focus() // lines 944, 1030, 1082, etc.
contentRef.current.focus() // line 882

The bug happens because keyboard navigation/typeahead/focus helpers try to focus DOM elements after UI state changes, but don't check if the elements still exist.

Additional context

From: https://posthoghelp.zendesk.com/agent/tickets/29700

Debug info

Kind: bug

Target area: analytics

Report event: http://go/ticketByUUID/bdfe0fa3-9eda-48ef-8979-be010ead0b32

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/01967c37-10e0-78e9-9483-a46312fda014?t=669

Exceptions: https://us.posthog.com/project/2/error_tracking?filterGroup=%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22key%22%3A%22%24session_id%22%2C%22value%22%3A%5B%2201967c37-10e0-78e9-9483-a46312fda014%22%5D%2C%22operator%22%3A%22exact%22%2C%22type%22%3A%22event%22%7D%5D%7D%5D%7D

Location: https://eu.posthog.com/project/27328/insights/new#q=%7B%22kind%22%3A%22InsightVizNode%22%2C%22source%22%3A%7B%22kind%22%3A%22TrendsQuery%22%2C%22series%22%3A%5B%7B%22kind%22%3A%22EventsNode%22%2C%22event%22%3A%22%24autocapture%22%2C%22name%22%3A%22%24autocapture%22%2C%22math%22%3A%22total%22%7D%2C%7B%22kind%22%3A%22EventsNode%22%2C%22event%22%3A%22%24pageview%22%2C%22name%22%3A%22Pageview%22%2C%22math%22%3A%22total%22%7D%5D%2C%22trendsFilter%22%3A%7B%7D%2C%22filterTestAccounts%22%3Atrue%7D%7D%20&

Sentry: http://go/sentryEU/27328

Persons-on-events mode for project: person_id_override_properties_on_events
@ordehi ordehi added bug Something isn't working right feature/insights Feature Tag: Insights overall team/product-analytics labels Apr 28, 2025
@ordehi
Copy link
Contributor Author
ordehi commented Apr 29, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right feature/insights Feature Tag: Insights overall team/product-analytics
Projects
None yet
Development

No branches or pull requests

1 participant
0