refactor(carousel demo): move Prev/Next triggers outside Viewport

Canonical placement (matches Mantine, shadcn-svelte): triggers sit as
siblings of Viewport (children of the Carousel root), not as siblings
of ItemGroup inside Viewport. Keeps the gesture-bearing ItemGroup
region clean of unrelated event targets; the recipe's absolute
positioning still anchors the triggers correctly because the carousel
root is `position: relative`.

The "clicks fail" report was the expected disabled state at the last
slide under loop=false — verified the next button correctly reports
disabled=true + opacity 0.4 once canGoNext becomes false. Enable loop
from the controls for infinite navigation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
active-uix
dev 5 months ago
parent b1b1e39dc0
commit f197463968

@ -142,9 +142,9 @@
' <Carousel.Item index={1}>Slide B</Carousel.Item>',
' <Carousel.Item index={2}>Slide C</Carousel.Item>',
' </Carousel.ItemGroup>',
' <Carousel.PrevTrigger />',
' <Carousel.NextTrigger />',
' </Carousel.Viewport>',
' <Carousel.PrevTrigger />',
' <Carousel.NextTrigger />',
' <Carousel.IndicatorGroup>',
' {#each slides as _, i}',
' <Carousel.Indicator index={i} />',
@ -243,9 +243,15 @@
</Carousel.Item>
{/each}
</Carousel.ItemGroup>
<Carousel.PrevTrigger />
<Carousel.NextTrigger />
</Carousel.Viewport>
<!--
Prev/Next triggers sit OUTSIDE the viewport (siblings, not
children) so their pointerdown isn't intercepted by the drag
gesture attached to the item-group. They still anchor visually
via the recipe's absolute positioning against the carousel root.
-->
<Carousel.PrevTrigger />
<Carousel.NextTrigger />
<Carousel.IndicatorGroup>
{#each slides as _, i (i)}
<Carousel.Indicator index={i} />

Loading…
Cancel
Save

Powered by TurnKey Linux.