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:
co-authored by
Claude Opus 5
parent
0093671bf3
commit
cab8d804a5
@@ -174,12 +174,10 @@ it('scrolls instantly and leaves every item unmasked under reduced motion', func
|
||||
JS));
|
||||
});
|
||||
|
||||
it('leaves a reduced-motion click on an item cut off at the row\'s edge where it is', function () {
|
||||
it('brings an item cut off at the row\'s edge into view when it is pressed under reduced motion', function () {
|
||||
// Owed by the Chromium baseline (step 32, docs/plans/material-3-browser-tests.md): reduced
|
||||
// motion writes a zero inset for every item (C-05, so none of them count as masked at all),
|
||||
// and the click-to-reveal affordance gates on that inset, so a press on an item only cut off
|
||||
// by the row's own edge — not by a mask — does not scroll it into view. Documented here, not
|
||||
// fixed: fixing isMasked() for this case is outside a hook rename.
|
||||
// motion writes a zero inset for every item (C-05), so a mask cannot say an item is only partly
|
||||
// shown; carousel.js reads the item's box against the row's instead, as for multi-aspect.
|
||||
$page = carouselShowcase(['reducedMotion' => 'reduce'])
|
||||
->assertScript(onCarousel(0, <<<'JS'
|
||||
const row = scroller.getBoundingClientRect()
|
||||
@@ -190,8 +188,10 @@ it('leaves a reduced-motion click on an item cut off at the row\'s edge where it
|
||||
$page->script(onCarousel(0, 'items[4].querySelector(\'[data-md-carousel-content]\').click()'));
|
||||
|
||||
$page->assertScript(onCarousel(0, <<<'JS'
|
||||
await pause(400)
|
||||
return scroller.scrollLeft === 0
|
||||
await pause(100)
|
||||
const row = scroller.getBoundingClientRect()
|
||||
const item = items[4].getBoundingClientRect()
|
||||
return Math.abs(scroller.scrollLeft) > 0 && item.left >= row.left - 1 && item.right <= row.right + 1
|
||||
JS));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user