Skip to content

Commit

Permalink
Fixing lastFocusedChildKey (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wozniak authored Jul 31, 2023
1 parent 1c329bd commit e01bd43
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/SpatialNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,9 +983,6 @@ class SpatialNavigationService {
this.setFocus(nextComponent.focusKey, focusDetails);
} else {
const parentComponent = this.focusableComponents[parentFocusKey];

this.saveLastFocusedChildKey(parentComponent, focusKey);

if (!parentComponent || !parentComponent.isFocusBoundary) {
this.smartNavigate(direction, parentFocusKey, focusDetails);
}
Expand Down Expand Up @@ -1262,11 +1259,6 @@ class SpatialNavigationService {
newFocusKey !== this.focusKey
) {
const oldComponent = this.focusableComponents[this.focusKey];
const parentComponent =
this.focusableComponents[oldComponent.parentFocusKey];

this.saveLastFocusedChildKey(parentComponent, this.focusKey);

oldComponent.onUpdateFocus(false);
oldComponent.onBlur(
this.getNodeLayoutByFocusKey(this.focusKey),
Expand Down Expand Up @@ -1437,14 +1429,13 @@ class SpatialNavigationService {

this.log('setFocus', 'focusKey', focusKey);

const lastFocusedKey = this.focusKey;
const newFocusKey = this.getNextFocusKey(focusKey);

this.log('setFocus', 'newFocusKey', newFocusKey);

this.setCurrentFocusedKey(newFocusKey, focusDetails);
this.updateParentsHasFocusedChild(newFocusKey, focusDetails);
this.updateParentsLastFocusedChild(lastFocusedKey);
this.updateParentsLastFocusedChild(newFocusKey);
}

updateAllLayouts() {
Expand Down

0 comments on commit e01bd43

Please sign in to comment.