applib/menu_layer: keep a mid-pan reload off the finger-owned offset - #1895
Draft
Mearman wants to merge 1 commit into
Draft
applib/menu_layer: keep a mid-pan reload off the finger-owned offset#1895Mearman wants to merge 1 commit into
Mearman wants to merge 1 commit into
Conversation
menu_layer_update_caches finishes by re-selecting the current row with MenuRowAlignNone, and prv_corrected_scroll_align promotes that to MenuRowAlignCenter on center-focused menus. A reload_data arriving mid-pan (timer, inbox, timeline update) therefore snaps the scroll offset to re-centre the selection under a finger that is still down -- and the next pan update computes from the gesture's base offset, jumping the content straight back. The code's own invariant says menu_layer_set_selected_index cannot be used mid-pan for exactly this reason. Keep the promotion, but not while a touch gesture owns the menu: the finger owns the offset until liftoff, when the carousel settles through prv_menu_touch_settle_to_center as before. Callers that genuinely want a re-centre pass MenuRowAlignCenter explicitly and are unaffected, and the button-path reconcile still promotes because no gesture is active when buttons are pressed. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Mearman
force-pushed
the
fix/menu-layer-reload-mid-pan
branch
from
August 19, 2026 21:04
5741b32 to
dda47a5
Compare
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.
Draft — still validating on hardware.
The last one I could reliably reproduce while playing with touch: on a center-focused carousel (the launcher), a data refresh landing mid-drag made the list visibly jump — yank one way, snap straight back — and feel desynced from my finger for the rest of the gesture.
menu_layer_update_caches finishes by re-selecting the current row with MenuRowAlignNone, and prv_corrected_scroll_align promotes that to MenuRowAlignCenter on center-focused menus. A reload mid-pan (timer, inbox, timeline update) therefore snaps the offset to re-centre the selection under a finger that is still down — and the next pan update recomputes from the gesture's base offset, jumping the content straight back. The code's own invariant says menu_layer_set_selected_index cannot be used mid-pan for exactly this reason.
The fix keeps the promotion but not while a touch gesture owns the menu: the finger owns the offset until liftoff, when the carousel settles through prv_menu_touch_settle_to_center as before. Callers that genuinely want a re-centre pass MenuRowAlignCenter explicitly and are unaffected, and the button-path reconcile still promotes because no gesture is active when buttons are pressed.
Covered by test_menu_layer__dispatch_pan_reload_mid_gesture_keeps_offset; full unit suite green.