Replacing RowList content during a held scroll leaves a stale column that a later key press uses

Device: Roku Ultra 4800RW, OS 16.0.4 build 834, 1080p (FHD channel)
Component: RowList, rowFocusAnimationStyle: “fixedFocus”
Severity: Medium–High. After a background content refresh, the row jumps back several items on the user’s next key press.

Summary

During a held LEFT or RIGHT, rowItemFocused reports only the hold’s start and its final position after the key is released. Suppose a held RIGHT is resting against the end of a row, and before its release has been reported:

  1. the app sets content to a new tree (which resets focus to [0,0])
  2. the app restores focus with jumpToRowItem to a different column.

RowList keeps the row’s previous horizontal position internally. If a horizontal key is then pressed within about 100ms of a later content replacement + jumpToRowItem, RowList starts the move from that stale position instead of the restored one. The row slides back to it.

Steps to reproduce

  1. Use the same RowList as in Report 1. Each refresh replaces content with new nodes: row 0 with 4 items, and row 1 with 5 new items added in front and the row ending 3 past the focused item. Each refresh then restores focus to the same item
    with jumpToRowItem([1, newIndex]). Since 5 items are inserted in front, newIndex is the old column + 5.
  2. Focus row 1 and hold RIGHT until the row is resting on its last item, with the key still held.
  3. While RIGHT is still held, trigger a refresh. In our test, a Timer fired it 1.6 seconds into a 2.5-second hold.
  4. Release RIGHT, wait about 1.5 seconds, and trigger another refresh with the device idle.
  5. Within about 50ms of that second refresh, press RIGHT.

Expected

Focus moves from the restored column to the next column (e.g. 23 → 24).

Actual

Focus moves to the row’s resting position from step 3 instead, for example [1,14] when the restore was at 23. currFocusColumn initially reads 24, then animates back to 14. Example:
CONTENT REPLACED rowItemFocused=[1,13] currFocusColumn=14 ← step 3: the row is resting on 14, but focus still reports 13
jumpToRowItem [1,18]
CONTENT REPLACED … jumpToRowItem [1,23] ← step 4
rowItemFocused=[1,14] currFocusColumn=24 ← step 5: RIGHT pressed

Notes

  • Writing jumpToRowItem to the row’s actual column before replacing the content didn’t prevent it.
  • Workaround: don’t replace content from a held LEFT/RIGHT press until the first rowItemFocused after its release, or after 0.5 seconds if nothing moved.
  • Related: a rowItemFocused change made inside a rowItemFocused observer (for example a jumpToRowItem written in that callback) isn’t reported. So the workaround has to apply the content change on the next frame.
  • Related: after any jumpToRowItem onto a different row, currFocusColumn keeps its previous value, often 0, until the next horizontal scroll.

2-content-replaced-during-hold.zip (9.6 KB)

I just created a bug ticket for this for our team to investigate