Fix search box focus loss (#485) and still quick-reaction emoji (#535) #540

Merged
charles merged 2 commits from fix-search-focus-hover-emoji into textchat 2026-11-14 08:41:08 +00:00
Owner

#485: the search box takes only one character

Cause: confirmed. The first Message::Edit sets search::State::suggesting, and header_popouts (screens/main/mod.rs) then returned stack![screen, backdrop, popout] instead of the bare screen. The root changed shape, so iced diffed the old tree's children (the screen row's own children) against the stack's children, rebuilt the screen's widget state, and the search text_input lost its focus. The new headless test reproduced this before the fix: typing "f" published Edit("f"), and the next key, "r", published nothing.

Fix: header_popouts now builds the popout as an Option for all three (pins, inbox, search suggestions) and over always returns a stack whose first layer is screen. The backdrop and popout layers are pushed only while one is open, so their visuals and click behaviour are the same as before. Opening or closing a popout now leaves the screen's widget state alone (iced's diff_children keeps child 0 and only truncates or extends the layers after it).

#535: animated quick reactions are still images in the hover bar

Cause: confirmed. hover_bar.rs drew every quick reaction with animate = false and added no URLs to the playing set. The context menu's quick-reaction row had the same gap.

What the original does:

  • Hover bar: MessageActionBar.tsx, QuickReactionButton uses useShouldAnimate({kind: 'emoji', isAnimated, isHovering}). An animated emoji plays all the time while "Animate emoji" is on. When the setting is off, it plays only while the pointer (or focus) is on that button.
  • Context menu quick row: MessageContextMenu.tsx uses renderQuickReactionEmoji, which plays the emoji always, whatever the setting.

Fix:

  • Hover bar:
    • hover_bar::animates holds the rule above.
    • Each animated custom emoji button is wrapped in a mouse_area that sends QuickReactionHovered. That message updates message_actions::State::quick_reaction_hovered, which is cleared when the pointer leaves the bar or close_all runs.
    • hover_bar::wanted_animated lists the URLs to play.
  • Context menu: the quick row draws with animate = true, and menu::wanted_animated lists its URLs.
  • Playing set: messages::actions_wanted_animated collects the URLs for the bar of the hovered row (or the bar under the pointer) and for the open menu. It runs for the channel view and the thread panel, and the results go into media::wanted's animated set so the animation clock runs.

The Add reaction and Remove reactions submenus are unchanged.

Tests

  • crates/fluxer-ui/tests/search_focus.rs::search_bar_keeps_focus_while_suggestions_open (headless, not on Windows): clicks the bar, types "from" over four frames that carry the widget tree (frame_after), and checks each Edit, the final query, suggesting, and that the popout offers from:. It failed before the fix with typing 'r' edits the query to "fr": [].

  • crates/fluxer-ui/tests/message_actions.rs::animated_quick_reactions_play: partyparrot becomes a quick reaction, then the test checks that it is in the playing set:

    • with a hovered row and the setting on: playing;
    • with the setting off: not playing;
    • with the pointer on the emoji: playing; after the pointer leaves: not playing;
    • in the open context menu's row with the setting off: playing.

    Before the fix it failed at "the bar plays it".

  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes locally (all steps, screenshot tests included). No golden changed.

Closes #485
Closes #535

🤖 Generated with Claude Code

## #485: the search box takes only one character **Cause: confirmed.** The first `Message::Edit` sets `search::State::suggesting`, and `header_popouts` (`screens/main/mod.rs`) then returned `stack![screen, backdrop, popout]` instead of the bare `screen`. The root changed shape, so iced diffed the old tree's children (the screen row's own children) against the stack's children, rebuilt the screen's widget state, and the search `text_input` lost its focus. The new headless test reproduced this before the fix: typing "f" published `Edit("f")`, and the next key, "r", published nothing. **Fix:** `header_popouts` now builds the popout as an `Option` for all three (pins, inbox, search suggestions) and `over` always returns a stack whose first layer is `screen`. The backdrop and popout layers are pushed only while one is open, so their visuals and click behaviour are the same as before. Opening or closing a popout now leaves the screen's widget state alone (iced's `diff_children` keeps child 0 and only truncates or extends the layers after it). ## #535: animated quick reactions are still images in the hover bar **Cause: confirmed.** `hover_bar.rs` drew every quick reaction with `animate = false` and added no URLs to the playing set. The context menu's quick-reaction row had the same gap. **What the original does:** - **Hover bar:** `MessageActionBar.tsx`, `QuickReactionButton` uses `useShouldAnimate({kind: 'emoji', isAnimated, isHovering})`. An animated emoji plays all the time while "Animate emoji" is on. When the setting is off, it plays only while the pointer (or focus) is on that button. - **Context menu quick row:** `MessageContextMenu.tsx` uses `renderQuickReactionEmoji`, which plays the emoji always, whatever the setting. **Fix:** - **Hover bar:** - `hover_bar::animates` holds the rule above. - Each animated custom emoji button is wrapped in a `mouse_area` that sends `QuickReactionHovered`. That message updates `message_actions::State::quick_reaction_hovered`, which is cleared when the pointer leaves the bar or `close_all` runs. - `hover_bar::wanted_animated` lists the URLs to play. - **Context menu:** the quick row draws with `animate = true`, and `menu::wanted_animated` lists its URLs. - **Playing set:** `messages::actions_wanted_animated` collects the URLs for the bar of the hovered row (or the bar under the pointer) and for the open menu. It runs for the channel view and the thread panel, and the results go into `media::wanted`'s animated set so the animation clock runs. The Add reaction and Remove reactions submenus are unchanged. ## Tests - `crates/fluxer-ui/tests/search_focus.rs::search_bar_keeps_focus_while_suggestions_open` (headless, not on Windows): clicks the bar, types "from" over four frames that carry the widget tree (`frame_after`), and checks each `Edit`, the final query, `suggesting`, and that the popout offers `from:`. It failed before the fix with `typing 'r' edits the query to "fr": []`. - `crates/fluxer-ui/tests/message_actions.rs::animated_quick_reactions_play`: partyparrot becomes a quick reaction, then the test checks that it is in the playing set: - with a hovered row and the setting on: playing; - with the setting off: not playing; - with the pointer on the emoji: playing; after the pointer leaves: not playing; - in the open context menu's row with the setting off: playing. Before the fix it failed at "the bar plays it". - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes locally (all steps, screenshot tests included). No golden changed. Closes #485 Closes #535 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The header's popouts (search suggestions, pins, inbox) returned the bare
screen while closed and a stack over it while open. When the first typed
character opened the suggestions, the root widget changed shape, iced
rebuilt the screen's widget state and the search box lost its focus: only
one character could be typed. The popouts now always sit in a stack whose
first layer is the screen, with the backdrop and popout layers only while
one is open, so opening or closing them leaves the screen's state alone.

Fixes #485

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The message hover bar drew its quick reactions as still images. As in
the original (MessageActionBar.tsx, QuickReactionButton:
useShouldAnimate({kind: 'emoji', isHovering})), an animated custom emoji
there now plays while "Animate emoji" is on, or while the pointer is on
it. The context menu's quick-reaction row plays them always, as the
original's renderQuickReactionEmoji does. Their animated URLs join the
screen's playing set so the animation clock runs.

Fixes #535

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
charles merged commit 2e1825be1d into textchat 2026-11-14 08:41:08 +00:00
Sign in to join this conversation.
No description provided.