mirror of
https://github.com/block/buzz.git
synced 2026-10-30 14:01:37 +00:00
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>