#
Bug Description
—
## 1. Summary
In a horizontal `Carousel` from `@amazon-devices/vega-carousel` 1.0.1 with `selectionStrategy=“pinned”`, the row scrolls by roughly one card whenever focus leaves it or comes back to it, but only after the selection has moved to the end of the row and back to the first item. With the first item selected, the focused row shows that item at the row’s start. As soon as focus moves to the row below, the unfocused row scrolls about one card to the left, so the first item is pushed off-screen and only a sliver of it is visible. Moving focus back up scrolls the row right again to show the first item, and moving down again shifts it left again. The same row with `selectionStrategy=“natural”` does not move at all.
A second, more serious symptom: after scrolling a pinned row a few items to the right and back, the carousel no longer lets the selection return to the first item. Left from the second item does nothing, so the first item, and anything reached by Left from it (our side menu via `nextFocusLeft`), becomes unreachable until the screen is reloaded. With `selectionStrategy=“natural”` the same steps work.
**App Name**: STARZ
**App Link on Amazon Appstore**: [fill in]
**Bug Severity**
Select one that applies [x]
* [x] Impacts operation of app
* [x] Blocks current development
* [ ] Improvement suggestion
* [ ] Issue with documentation
* [ ] Other
Every swimlane on our Home screen is a pinned carousel stacked in a vertical list, so normal Up/Down navigation makes rows jump sideways. This blocks our migration to RN 0.83 / vega-carousel 1.0.1. The same screens on RN 0.72 with vega-carousel 0.2.x do not do this.
## 2. Steps to Reproduce
1. Render two or more horizontal pinned carousels stacked vertically (configuration in section 7), each with more items than fit on screen.
2. Focus the top row and press Right until the last item is selected.
3. Press Left until the first item is selected again. The first item is fully visible at the start of the row (screenshot 1).
4. Press Down to move focus to the row below. The top row scrolls about one card to the left: the first item is now mostly off-screen and the second item sits where the first one was (screenshot 2).
5. Press Up. The top row scrolls right again to show the first item, which has focus.
6. Press Down again. The top row shifts left again. This repeats on every Up/Down.
Second symptom (can’t return to the first item):
1. Focus the first item of a pinned row (its `nextFocusLeft` points at a side menu outside the carousel).
2. Press Right three times, then Left three times.
3. Focus is on the second item, which now sits at the row’s start; the first item is scrolled off to the left.
4. Press Left again, any number of times. Nothing happens: the selection never returns to the first item, and the side menu is never reached.
## 3. Observed Behavior
```
After step 3, the horizontal scroll position of a pinned row depends on whether the row has focus:
Row state First item (index 0) Second item (index 1)
Focused, index 0 selected fully visible at row start next to it
Unfocused, index 0 selected only a ~40 px sliver visible at the row start (about one card further)
The selected index does not change: on re-entry focus lands on index 0 again, and the row scrolls back.
Second symptom, focus events logged from each item’s onFocus during the steps above
(Down into the row, Right x3, Left x4):
pinned: index 0 → 1 → 2 → 2 → 1 → stuck on 1 (the third Right also did not advance;
further Left presses do nothing)
natural: index 0 → 1 → 2 → 3 → 2 → 1 → 0 → side menu (nextFocusLeft)
```
## 4. Expected Behavior
```
Left should always move the selection back to the previous item, including to index 0 after the row has scrolled.
A row’s scroll position should not change when focus moves to another row and back. The unfocused row
should stay exactly where it was while focused, as it does with selectionStrategy=“natural” (screenshot 3)
and as it did with vega-carousel 0.2.x.
```
### 4.a Possible Root Cause & Temporary Workaround
```
Root cause: unknown (the scrolling happens in com.amazon.keplerscript.carousel.so, which JS cannot inspect).
It looks as if the carousel keeps the scroll position from the last time an item was pinned (index 1,
while moving left from the end) and re-applies it when the row loses focus, instead of the position it is
actually showing for index 0 at the start of the row.
What we tried:
- selectionStrategy=“natural”: no shift, but the focused item floats instead of staying pinned, which
changes our UX.
- Changing pinnedSelectedItemOffset (several percentages, and ‘start’): either the shift remains, or the
first item is clipped at the row start, or the end of the row lays out incorrectly. We found no offset
where the start of the row, the end of the row and focus changes all behave.
- Calling scrollTo(0, false) on the ref when the selection reaches index 0: does not prevent the shift.
We also noticed that the documented pinnedSelectedItemOffset does not match where the item lands. Our device
measurements show the pinned item’s centre (not its leading edge) is placed at the offset, and with a 0%
offset the selected card is clipped under our side menu. We compensate by computing the percentage from the
measured card width.
Workaround: none that keeps pinned behaviour.
```
## 5. Logs or crash report
No crash or error is logged; this is a layout issue. Attached:
* `1_row-focused_first-card-at-start.png`: after step 3, with focus on the first item of the top row (“Leaving Soon”).
* `2_row-unfocused_shifted-one-card.png`: after step 4, with focus on the row below. The top row has shifted about one card left.
* `3_natural-strategy_no-shift.png`: the same sequence with `selectionStrategy=“natural”`. No shift.
## 6. Environment
* **SDK Version:** Active SDK Version 0.24.9859
* **React Native Version:** `react-native` 0.83.0, `@amazon-devices/react-native-kepler` 4.0.1+rn0.83.0
* **vega-carousel Version:** `@amazon-devices/vega-carousel` 1.0.1
* **App State:** Foreground
* **Device:** Fire TV Stick (callie, armv7)
* **OS Information:** `BUILD_DESC=“OS 2.0 (TV Ship/529)”`, `BUILD_FINGERPRINT=“4.0.539433.0(3072cab629675a74)/529N:user/release-keys”`, `VERSION_NUMBER=“2602000052920”`, `RELEASE_ID=“26”`
## 7. Example Code Snippet / Screenshots / Screengrabs
```tsx
import { Carousel } from ‘@amazon-devices/vega-carousel’;
// One of several rows stacked in a vertical list; each row has ~10-20 items, cards are 400 x 225.
<Carousel
animationDuration={{ itemScrollDuration: 0.1 }}
containerStyle={{ marginRight: -140 }} // row overflows the right edge so the last card can reach it
dataAdapter={dataAdapter}
itemStyle={{ itemPadding: 30, pressedItemScaleFactor: 1.0, selectedItemScaleFactor: 1.0 }}
navigableScrollAreaMargin={5}
pinnedSelectedItemOffset={pinnedOffset} // (cardWidth / 2) / (rowWidth + overflow - 2 * margin), as a percentage
renderItem={renderItem}
renderedItemsCount={10}
selectionStrategy=“pinned”
uniqueId={uniqueId}
/>
```
We have not yet reproduced it in a minimal new app; we can provide one if that would help.
—
##
Playback Issues
—
```
N/A
```
—
##
Additional Context
—
```
Questions:
1. Is a pinned carousel expected to re-layout when focus leaves and re-enters it? If so, is there a prop
to keep the current scroll position on blur?
2. What is the exact geometry for pinnedSelectedItemOffset in 1.0.1 (leading edge vs centre, and which
width the percentage applies to), so we can place the pinned item at the row’s start without clipping?
```






