Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit 8620d4a

Browse files
committed
Fixed regression with autoRestoreFocus
1 parent 01d2c06 commit 8620d4a

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.12.1]
8+
### Fixed
9+
- Fixed regression with using `autoRestoreFocus` on components that are focused + getting unmounted and don't have parent
10+
711
## [2.12.0]
812
### Added
913
- added `autoRestoreFocus` prop to control whether parent component should restore focus on any available child when a currently focused child component is unmounted.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@noriginmedia/react-spatial-navigation",
3-
"version": "2.12.0",
3+
"version": "2.12.1",
44
"description": "HOC-based Spatial Navigation (key navigation) solution for React",
55
"main": "dist/index.js",
66
"files": [

src/spatialNavigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ class SpatialNavigation {
790790
/**
791791
* If the component was also focused at this time, focus another one
792792
*/
793-
if (isFocused && parentComponent.autoRestoreFocus) {
793+
if (isFocused && parentComponent && parentComponent.autoRestoreFocus) {
794794
this.setFocus(parentFocusKey);
795795
}
796796
}

0 commit comments

Comments
 (0)