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

Commit

Permalink
Fixed regression with autoRestoreFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
asgvard committed Mar 16, 2020
1 parent 01d2c06 commit 8620d4a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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).

## [2.12.1]
### Fixed
- Fixed regression with using `autoRestoreFocus` on components that are focused + getting unmounted and don't have parent

## [2.12.0]
### Added
- added `autoRestoreFocus` prop to control whether parent component should restore focus on any available child when a currently focused child component is unmounted.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@noriginmedia/react-spatial-navigation",
"version": "2.12.0",
"version": "2.12.1",
"description": "HOC-based Spatial Navigation (key navigation) solution for React",
"main": "dist/index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/spatialNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ class SpatialNavigation {
/**
* If the component was also focused at this time, focus another one
*/
if (isFocused && parentComponent.autoRestoreFocus) {
if (isFocused && parentComponent && parentComponent.autoRestoreFocus) {
this.setFocus(parentFocusKey);
}
}
Expand Down

0 comments on commit 8620d4a

Please sign in to comment.