Repository navigation
Commit e4c38af
fix(messages): reveal the focused thumbnail inside the image strip
Tabbing through a posted image strip relies on native focus scrolling, and
both engines refuse to scroll horizontally when the newly focused element
is already partly visible. Blink sets the partial-visibility behaviour to
no-scroll in Element::UpdateSelectionOnFocus, and WebKit keeps its 32px
legacy horizontal visibility threshold on the focus reveal path; only
scrollIntoView() opts out of either rule. A thumbnail whose far edge is
clipped therefore takes focus without ever coming fully into view, and its
focus ring is cut off. On the base commit this already happens for every
strip width from 330 to 390px. The feed's scrollbar-gutter narrows the
strip by 10px (Linux) or 11px (legacy-scrollbar macOS) under headless
Chromium, which moved image-strip.spec.mjs's fixed 768px viewport into
that window and made the Chromium shard of PR #451 fail at the last-tile
visibility check (review comment P2).
MessageRow.tsx now handles onFocus on the strip group (React's onFocus is
the bubbling focusin, so one handler covers every tile) and nudges only
the strip's own scrollLeft until the focused tile lies inside the strip's
scroll-padding box. In Blink the native reveal runs first and the handler
corrects the clipped case; in WebKit the handler runs first and the
timer-driven native reveal then finds a fully visible element and does
nothing. A strip-local adjustment is used instead of scrollIntoView so
that overflow: hidden ancestors such as the thread container are never
scrolled. Inline start and end are treated as left and right, matching
the app's LTR layout. The feed's scrollbar-gutter CSS is unchanged.
tests/browser/image-strip.spec.mjs now asserts the focused last tile lies
inside the strip's scroll-padding box rather than the parent's bounding
rect. This also catches the base commit's 1px short-of-max state at
398px, where the tile sat inside the border box but past the
scroll-padding end with its ring clipped. Where the strip is too narrow
to hold a tile plus both paddings (the 390px viewport once a gutter is
reserved) the tile's far edge must sit exactly on the scroll-padding end.
No assertion was loosened.
Suites run (Hermit bin/pnpm):
- biome check --error-on-warnings MessageRow.tsx image-strip.spec.mjs:
clean
- typecheck: clean
- vitest src/features/messages/MessageRow.test.tsx: 71 passed
- Playwright --project=chromium --project=webkit --no-deps
image-strip.spec.mjs on macOS with legacy scrollbars (Chromium reserves
an 11px gutter and reproduced the CI failure before the fix): 2 passed
- Playwright --project=chromium --project=webkit --no-deps gifs,
image-scroll, image-strip, message-management, messages, startup:
64 passed
- Linux container (mcr.microsoft.com/playwright:v1.63.0-noble, CI config)
--project=chromium and --project=webkit --no-deps image-strip.spec.mjs:
1 passed each. Swapping the unpatched MessageRow.tsx back into the
container fails the Chromium run at the same assertion (now line 131,
previously 113), so the CI failure is gone rather than moved.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Matt Toohey <[email protected]>1 parent b68a91a commit e4c38af
2 files changed
Lines changed: 48 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
91 | 118 | | |
92 | 119 | | |
93 | 120 | | |
| |||
550 | 577 | | |
551 | 578 | | |
552 | 579 | | |
| 580 | + | |
553 | 581 | | |
554 | 582 | | |
555 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
| 115 | + | |
| 116 | + | |
108 | 117 | | |
109 | | - | |
110 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
111 | 129 | | |
112 | 130 | | |
113 | 131 | | |
| |||
0 commit comments