Skip to content

fix(focus): enclosing leaf search and claim patience - #133

Merged
RuudBurger merged 2 commits into
mainfrom
ruud/focus-search-and-claim-patience
Oct 12, 2026
Merged

RuudBurger merged 2 commits into
mainfrom
ruud/focus-search-and-claim-patience

Conversation

@RuudBurger

Copy link
Copy Markdown
Member

Two FocusManager fixes from moving Plex's Lightning app onto native-style focus.

Enclosing leaf (RNG-901): Down treated any sibling that encloses the source vertically as below it. That's meant for a screen scene behind a floating header, but it also hit leaves, so a full-height gutter catcher won Down from the last row of every screen without its own trap. The rule now only applies to targets with focusable children, roughly what Android's FocusFinder does. Also guards a NaN in getAlignment so a 0x0 focused element can still move.

Claim patience (RNG-898): a claim resolved its destinations once and then held on forever. It now gets a second, like tvOS and Android. A destination key that registers late gets focus if focus is still in the claim and the user hasn't moved (D-pad or a landed focusByKey). A claim with nothing to land on loses to the next candidate after that second instead of parking focus on an empty group. Unfocusable targets also wait the full second here, because Lightning elements often turn focusable only after layout.

Cost is limited to while a claim is pending (one timer, no polling). Should make useLightningClaimPatience in the app redundant once bumped.

Tests: 370 pass, new specs for both fixes (7 of them fail without the fixes). Changesets included (patch).

@RuudBurger
RuudBurger marked this pull request as ready for review October 12, 2026 16:55
@RuudBurger
RuudBurger merged commit bec12c9 into main Oct 12, 2026
1 check passed
@RuudBurger
RuudBurger deleted the ruud/focus-search-and-claim-patience branch October 12, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant