NXT-15051: Fixed focus jump and scroll freeze in VirtualList when scrolled by long press#362
Open
vJIYEv wants to merge 2 commits into
Open
NXT-15051: Fixed focus jump and scroll freeze in VirtualList when scrolled by long press#362vJIYEv wants to merge 2 commits into
vJIYEv wants to merge 2 commits into
Conversation
…olled by long press Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #362 +/- ##
===========================================
+ Coverage 81.97% 82.05% +0.07%
===========================================
Files 153 153
Lines 7480 7502 +22
Branches 2251 2258 +7
===========================================
+ Hits 6132 6156 +24
+ Misses 1043 1041 -2
Partials 305 305 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Issue Resolved / Feature Added
During key long press in VirtualList, focus jumped backward and scrolling froze permanently.
Resolution
This occurred because VirtualList recycles DOM nodes during scroll — when a recycled node's
data-indexwas read as the event target index, the key handler detected an anomaly and silently discarded the event. With each subsequent repeat event discarded the same way, scrolling halted indefinitely.A secondary issue: when focus entered a VirtualList while a key was already held (e.g., held before panel transition), the first event had
repeat: true, causing focus to skip item 0 immediately.prevKeyDownIndexwas a module-levelletvariable shared across all VirtualList instances. Replaced with per-instanceprevKeyDownIndexRefandhasProcessedKeyDownRef(useRef) to eliminate cross-instance state pollution.isOutdatedIndexdetects whendata-indexon the focused DOM node jumped unnaturally during repeat (recycling artifact). Instead of silently returning, now callshandleDirectionKeyDownwith a corrected next index derived fromprevKeyDownIndexRef, then advances the ref. This resumes scroll continuity rather than freezing.isFirstEntryRepeatdetectsrepeat: trueon the very first keydown after entering the list (hasProcessedKeyDownRefis stillfalse). Blocks and resets the accelerator so focus stays on the entry item.resetAcceleratoris now destructured from context so both new code paths can resetSpotlightAcceleratoron early return.resetAcceleratorcallback to thecontextobject passed touseEventKey, delegating toSpotlightAccelerator.reset().Additional Considerations
Links
NXT-15051
Comments
Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)