Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

fix(canvas): fix the Activity bell's hover card resurfacing, and wedging, after it navigates - #4017

Merged
trunk-io[bot] merged 3 commits into
mainfrom
posthog-code/fix-activity-bell-popover-after-nav
Jul 30, 2026
Merged

fix(canvas): fix the Activity bell's hover card resurfacing, and wedging, after it navigates#4017
trunk-io[bot] merged 3 commits into
mainfrom
posthog-code/fix-activity-bell-popover-after-nav

Conversation

@adboio

@adboio adboio commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

Two things go wrong with the Activity bell in the channels nav, both every time:

  1. Click the bell → you land on the Activity page. Open any notification from there and the Activity hover card pops up over the task you just navigated to.
  2. After that click the bell keeps a pressed/active look, and hovering it never opens the card again.

Why: the bell is both a popover trigger and a nav button, and quill's trigger opens the card on click as well. Our handler runs first, then the trigger's own open lands — still inside the same click, before the route changes — so the card records itself as open. The Activity page only hid that (open={!isActivity && activityOpen}) rather than closing it, so it resurfaced on the next navigation.

The pressed-and-dead-hover half has the same root: refusing an open isn't free. Base UI applies the open to its store before handing it to us, so a false we hand back desyncs the trigger — it keeps data-popup-open / data-pressed, and its hover-open path bails on the stale internal state until the trigger remounts. The old !isActivity gate refused opens the same way, so hovering the bell on the Activity page wedged it too.

Changes

Stop refusing opens rather than papering over the effects:

  • The trigger's own click-open is prevented outright (event.preventBaseUIHandler()) — the click's one job is to navigate.
  • The Activity page renders the bell with no popover wrapped around it, so there are no hover-opens to refuse there. This matches what the sidebar's Activity row already does.
  • The open state now lives in the component that only mounts off the Activity page, so it starts closed on every visit. Nothing to mask, nothing left over, and onOpenChange is a plain mirror.

How did you test this?

Diagnosed by probing the trigger's DOM state through the reported flow, which showed data-popup-open/data-pressed stuck on the bell and hover dead afterwards — both reproducible on main.

  • Three regression tests in ChannelNav.test.tsx: no card after the bell navigates and you open a notification, hover still opens the card afterwards, and no leftover popover state on the bell. All three fail on main, pass here.
  • Full @posthog/ui suite: 283 files / 2409 tests pass, including the existing hover-open, close-on-unhover, and no-card-on-the-Activity-page tests.
  • turbo run typecheck --filter=@posthog/ui and biome check on the touched files: clean.

Not driven in the running Electron app — worth a click-through when you pull it.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

…navigates

Clicking the Activity bell navigates to the Activity page, but quill's popover
trigger runs its own open handler after ours and still inside the same click, so
`isActivity` is false and the card stores itself as open. The Activity page only
hid that state instead of clearing it, so the card reappeared over the next page
opened from the feed.

Swallow the open belonging to the navigating click, the same way the sidebar's
Activity row already does.

Generated-By: PostHog Code
Task-Id: f89ba875-c0c8-4a08-b088-67b2a900e66d
@trunk-io

trunk-io Bot commented Jul 30, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 9926f2e.

The first pass swallowed the open that quill's trigger applies on click, which
stopped the stray card but left the underlying problem: refusing an open desyncs
the trigger. Base UI applies the open internally before we see it, so handing
back `false` leaves the bell stuck with `data-popup-open`/`data-pressed` and its
hover-open dead until the trigger remounts. The old `!isActivity` gate refused
opens the same way, so this was reachable on the Activity page too.

Remove the refusals instead: the trigger's own click-open is prevented outright
with `preventBaseUIHandler`, and the Activity page renders the bell with no
popover at all. Owning the open state in a component that only mounts off the
Activity page means it is born closed on every visit, so there is nothing to
mask and nothing left over to resurface.

Generated-By: PostHog Code
Task-Id: f89ba875-c0c8-4a08-b088-67b2a900e66d
@adboio adboio changed the title fix(canvas): stop the Activity hover card resurfacing after the bell navigates fix(canvas): fix the Activity bell's hover card resurfacing, and wedging, after it navigates Jul 30, 2026
Generated-By: PostHog Code
Task-Id: f89ba875-c0c8-4a08-b088-67b2a900e66d
@adboio
adboio marked this pull request as ready for review July 30, 2026 19:19
@adboio adboio added the Stamphog This will request an autostamp by stamphog on small changes label Jul 30, 2026
@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "refactor(canvas): drop comments from the..." | Re-trigger Greptile

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contained UI-only fix to a canvas nav popover's open-state handling, with new regression tests covering the exact bug; no risky territory (no auth, billing, API, deps, or CI changes) touched.

  • Author wrote 0% of the modified lines and has 12 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 93L, 1F substantive, 132L/2F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (132L, 2F, single-area, fix)
stamphog 2.0.0b3 .stamphog/policy.yml @ 5ac5892 · reviewed head 9926f2e

@trunk-io
trunk-io Bot merged commit 46fdc26 into main Jul 30, 2026
44 of 45 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/fix-activity-bell-popover-after-nav branch July 30, 2026 19:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant