Reveal a cut-off carousel item under reduced motion

Plan step 36 review of a149970d. Reduced motion writes a zero inset for
every item, so isMasked() never called one partly shown and a press on
an item the row cut off did nothing. It now reads the item's box against
the scrollport there, as it already did for multi-aspect, and the
browser test the rewrite added to document the gap asserts the reveal
instead (plan step 32's owed test).

A focused item's inset ring is 3px in again: Tailwind's
-outline-offset-3 is 3px, not the 12px the rewrite wrote.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
Andreas Reinhold / reini
2026-09-14 22:05:40 +02:00
co-authored by Claude Opus 5
parent 0093671bf3
commit cab8d804a5
4 changed files with 23 additions and 13 deletions
+6 -3
View File
@@ -26,7 +26,8 @@
* Under reduced motion the buttons and keys scroll instantly and nothing is masked at all: M3
* says the parallax goes and items "should no longer expand as they come into view — all items
* are the same size", so every item stays at the strategy's large size and the keylines only
* decide where the row snaps.
* decide where the row snaps. An item is then "not fully open" when the row cuts it off, so a
* press or focus on it still brings it into view.
*
* ---------------------------------------------------------------------------------------
* Keyline maths ported from androidx (https://github.com/androidx/androidx), commit
@@ -1218,8 +1219,10 @@ document.addEventListener('alpine:init', () => {
return Math.abs(state.snaps[index] - this.scrollOffset()) > 1
}
// Nothing masks a multi-aspect item, so "not fully open" is "cut off by the row".
if (state.measured) {
// Nothing masks a multi-aspect item, nor any item under reduced motion (render()
// writes a zero inset for every one), so there "not fully open" is "cut off by the
// row": its box reaching past the scrollport's edge.
if (state.measured || state.reducedMotion.matches) {
const row = this.$refs.scroller.getBoundingClientRect()
const item = state.items[index].element.getBoundingClientRect()