mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +00:00
## Problem https://posthoghelp.zendesk.com/agent/tickets/59042 `ph-no-capture` elements come back during replay with `position: absolute` + inline `left/top` regardless of their original positioning. In-flow elements (e.g. flex children, paragraph spans) get pulled out of flow and sibling layout collapses. <!-- Who are we building for, what are their needs, why is this important? --> ## Changes - snapshot.ts: when blocking, also capture `rr_position`, `rr_transform` (only if not `none`), and `rr_display` (only if `inline`). - rebuild.ts: skip the forced `position: absolute` when `rr_position === 'static'` and no contributing transform; promote inline placeholders to `inline-block` so width/height hold the slot. Old recordings (no `rr_position`) keep the legacy absolute path. Tested: - `pnpm --filter @posthog/rrweb-snapshot test` — added 3 snapshot cases (static block, transformed, inline) and 5 rebuild cases (in-flow, transformed-in-flow, non-static, inline promotion, inline already-positioned). - `pnpm --filter @posthog/rrweb test` — full integration suite passes; one block-element fixture snapshot updated to reflect the intended behavior change (blocked divs rebuild as `width/height` only, no `position: absolute`). <!-- What is changed and what information would be useful to a reviewer? --> ## Release info Sub-libraries affected ### Libraries affected <!-- Please mark which libraries will require a version bump. --> - [ ] All of them - [x] posthog-js (web) - [ ] posthog-js-lite (web lite) - [ ] posthog-node - [ ] posthog-react-native - [ ] @posthog/react - [ ] @posthog/ai - [ ] @posthog/convex - [ ] @posthog/next - [ ] @posthog/nextjs-config - [ ] @posthog/nuxt - [ ] @posthog/rollup-plugin - [ ] @posthog/webpack-plugin - [ ] @posthog/types ## Checklist - [x] Tests for new code - [x] Accounted for the impact of any changes across different platforms - [x] Accounted for backwards compatibility of any changes (no breaking changes!) - [x] Took care not to unnecessarily increase the bundle size ### If releasing new changes - [x] Ran `pnpm changeset` to generate a changeset file <!-- For more details check RELEASING.md -->