Skip to content

fix(desktop): custom emoji reaction rendering + picker autofocus#831

Merged
wesbillman merged 2 commits into
mainfrom
brain/fix-emoji-reaction-img
Jun 3, 2026
Merged

fix(desktop): custom emoji reaction rendering + picker autofocus#831
wesbillman merged 2 commits into
mainfrom
brain/fix-emoji-reaction-img

Conversation

@wesbillman
Copy link
Copy Markdown
Collaborator

What

Two related desktop fixes for the custom-emoji reaction flow:

  1. Reaction broken-image fix — custom-emoji reactions now render through the localhost media proxy instead of leaking the raw relay URL. One-line rewriteRelayUrl() fix in MessageReactions.tsx.
  2. Reaction picker autofocusautoFocus on the reaction emoji Picker so the picker's search field is focused the instant it opens; the user can type to filter immediately.

Test support + guard

  • New e2e coverage in custom-emoji.spec.ts: a :react: relay-origin fixture proves rewriteRelayUrl() actually ran (avoids the example.com false-positive trap), plus a toggle-off assertion that the reaction pill disappears after remove_reaction.
  • Mock bridge (e2eBridge.ts): added mock add_reaction/remove_reaction handlers. Reaction event ids are now 64-hex via mockEventId() so the kind:5 deletion's e tag is actually honored by the timeline deletion logic (it rejects 32-hex ids) — without this, toggling off a reaction in mock mode silently left a stale pill.

Verification

  • pnpm typecheck
  • pnpm biome check ✅ on all touched files
  • pnpm test:e2e:smoke custom-emoji.spec.ts ✅ — 4/4 (proxy rewrite + toggle-off), with autofocus in place
  • Pre-push hooks (rust tests, clippy, tauri tests) ✅

Reviewer notes

  • The 64-hex mock-deletion fix was flagged independently by Pinky's review and a Codex second-opinion pass, then verified resolved by Pinky's final sanity pass.
  • Full parallel test:e2e:smoke aggregate is flaky in this environment (non-deterministic search/focus/visibility assertions under contention) — pre-existing, unrelated to this diff; every suite touching the changed paths passes clean in isolation.

wesbillman and others added 2 commits June 3, 2026 09:30
Custom emoji reactions rendered as a broken image while the same emoji
worked inline in chat. WKWebView's network stack bypasses WARP, so a
direct relay `/media/...` URL gets a Cloudflare Access 403. Every other
media `<img>` in the app goes through `rewriteRelayUrl()` to proxy via
localhost; the reaction renderer (`EmojiGlyph`) was the one path that
used the raw `reaction.emojiUrl`, shipped that way in the custom-emoji
launch (PR #816).

Wrap `reaction.emojiUrl` in `rewriteRelayUrl()`, matching the chat
renderer and the rest of the app.

Add an e2e guard (custom-emoji.spec.ts) that drives the real interactive
react flow and asserts the rendered reaction `<img>` src resolves to the
localhost media proxy — it fails on the pre-fix raw relay URL. The guard
also toggles the reaction off and asserts the pill disappears, covering
the mock-bridge deletion path.

To support the guard, the e2e bridge gains `add_reaction` /
`remove_reaction` / `get_media_proxy_port` mocks and a relay-hosted
reaction fixture. Reaction events use a 64-hex id so the kind:5 deletion
is honored by the timeline (getDeletionTargets requires a 64-hex `e`
tag); `createMockEvent`'s default id shape is unchanged.

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Add `autoFocus` to the reaction emoji Picker in MessageActionBar so the
picker's search field receives focus the moment the picker opens, letting
the user type to filter immediately without an extra click.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman requested a review from a team as a code owner June 3, 2026 15:38
@wesbillman wesbillman merged commit 7797ae7 into main Jun 3, 2026
15 checks passed
@wesbillman wesbillman deleted the brain/fix-emoji-reaction-img branch June 3, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant