Skip to content

Commit

Permalink
Issue #25 - Fix focus lost (#54)
Browse files Browse the repository at this point in the history
* updated parentFocusKey when removeFocusable

* Updated changelog and bump version
  • Loading branch information
guilleccc authored Dec 15, 2022
1 parent b9dc5e6 commit 6a7e164
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [1.1.4]
## Changed
- Update `parentFocusKey` when `removeFocusable`
- Fix issue with `destroy` (added `bind`)

# [1.1.3]
## Changed
- `Reflect.deleteProperty` was replaced by `delete` to be es5 compliant.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@noriginmedia/norigin-spatial-navigation",
"version": "1.1.3",
"version": "1.1.4",
"description": "React hooks based Spatial Navigation solution",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions src/SpatialNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,13 @@ class SpatialNavigationService {
return;
}

forEach(this.focusableComponents, (component) => {
if (component.parentFocusKey === focusKey && component.focusable) {
// eslint-disable-next-line no-param-reassign
component.parentFocusKey = parentFocusKey;
}
});

/**
* If the component was also focused at this time, focus another one
*/
Expand Down

0 comments on commit 6a7e164

Please sign in to comment.