Files
buzz/desktop/tests
Riley Crane e505e54610 fix(desktop): restore focus to the invoking card, not the first URL match
The panel-close focus restore located the opener card by document URL
alone, but the same attachment can appear in several messages — several
cards, one URL — so querySelector always returned the first DOM match
and closing a panel opened from a later duplicate focused the wrong
card.

FileCard now passes the clicked element through the open call, and the
channel pane opener records it as its DOM-order index among the cards
sharing that URL — a per-invocation identity that survives the
narrow-layout unmount/remount where an element reference cannot. The
restore consumes the record (deep-link/reload opens fall back to the
first match, as before), clamps when the recorded card is gone, and
still yields to any control that already claimed focus.

Covered by a JSDOM unit suite for the record/restore contract and a
duplicate-URL narrow-layout keyboard e2e.

Signed-off-by: Riley Crane <rileycrane@squareup.com>
Co-authored-by: Fizz <d4ec90109b43092b0ec94cf136850915a3732a29ab3089a1dec43d2ed43dd6eb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 13:30:51 -07:00
..