Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not virtualize items around the last focused item #32646

Closed
wants to merge 13 commits into from

Commits on Jul 19, 2022

  1. Enable Generic Discontiguous Regions within VirtualizedList

    Builds upon the `CellRenderMask` data structure added with facebook#31420, and VirtualizedList coverage added with facebook#31401.
    
    VirtualizedList currently keeps a [first, last] range as state, tracking the region of cells to render. The render functions uses this as an input, along with a few special cases to render more (sticky headers, initial render region.)
    
    This change moves to instead keep state which describes discontiguous render regions. This mask is continually updated as the viewport changes, batch renders expand the region, etc. Special cases are baked into the render mask, with a relatively simple tranformation from the mask to render function.
    
    This representation makes it much easier to support keyboarding scenarios, which require keeping distinct regions (e.g. for last focused) realized while out of viewport.
    
    MS/FB folks have a video discussion about VirtualizedList here: https://msit.microsoftstream.com/video/fe01a1ff-0400-94b1-d4f1-f1eb924b1809
    
    facebook#31401 added quite a few snapshot tests, centering around the logic this change is touching. I manually validated RNTester FlatList examples (and their should be some upstream UI testing for them).
    NickGerleman committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    19cb111 View commit details
    Browse the repository at this point in the history
  2. Do not virtualize items adjacent to the last focused item

    This change also includes the contents of facebook#32638
    
    This change makes VirtualizedList track the last focused cell, through the capture phase of `onFocus`. It will keep the last focus cell, and its neighbors rendered. This allows for some basic keyboard interactions, like tab/up/down when on an item out of viewport. We keep the last focused rendered even if blurred for the scenario of tabbing in and and out of the VirtualizedList.
    
    Validated via UT.
    NickGerleman committed Jul 19, 2022
    Configuration menu
    Copy the full SHA
    8a9c4e2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    32e73ee View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2a5503e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f0de65b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    03f180f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    eb64202 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    75cc358 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    093968e View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2022

  1. Configuration menu
    Copy the full SHA
    7c23f47 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d739bc3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    65517fe View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8437121 View commit details
    Browse the repository at this point in the history