@@ -5,7 +5,7 @@ export default class ToggleAndDisplayPattern extends React.Component {
55 constructor ( ...args ) {
66 super ( ...args ) ;
77 this . wrapper = null ;
8- this . _activeChidlren = [ ] ;
8+ this . _activeChildren = [ ] ;
99 this . _hiddenChildren = [ ] ;
1010 }
1111
@@ -36,7 +36,7 @@ export default class ToggleAndDisplayPattern extends React.Component {
3636 child . ref ( c ) ;
3737 }
3838 if ( c ) {
39- this . _activeChidlren . push ( c ) ;
39+ this . _activeChildren . push ( c ) ;
4040 }
4141 } ;
4242 return React . cloneElement ( child , newProps ) ;
@@ -58,7 +58,7 @@ export default class ToggleAndDisplayPattern extends React.Component {
5858 }
5959
6060 componentWillUpdate ( ) {
61- this . _activeChidlren = [ ] ;
61+ this . _activeChildren = [ ] ;
6262 this . _hiddenChildren = [ ] ;
6363 }
6464
@@ -67,7 +67,7 @@ export default class ToggleAndDisplayPattern extends React.Component {
6767 }
6868
6969 componentDidUpdate ( ) {
70- this . _updatePattens ( )
70+ this . _updatePattens ( ) ;
7171 }
7272
7373 render ( ) {
@@ -90,7 +90,7 @@ export default class ToggleAndDisplayPattern extends React.Component {
9090 const activeElement = document . activeElement ;
9191 isActiveWrapper = wrapper . contains ( activeElement ) ;
9292 }
93- this . _activeChidlren . forEach ( child => {
93+ this . _activeChildren . forEach ( child => {
9494 const childDOM = findDOMNode ( child ) ;
9595 if ( childDOM ) {
9696 childDOM . hidden = false ;
@@ -103,11 +103,12 @@ export default class ToggleAndDisplayPattern extends React.Component {
103103 }
104104 } ) ;
105105 // move to focus
106- if ( isActiveWrapper && this . _activeChidlren . length === 1 ) {
107- const activeDOM = findDOMNode ( this . _activeChidlren [ 0 ] ) ;
108- if ( activeDOM ) {
106+ if ( isActiveWrapper && this . _activeChildren . length === 1 ) {
107+ const activeDOM = findDOMNode ( this . _activeChildren [ 0 ] ) ;
108+ if ( activeDOM && ! activeDOM . contains ( document . activeElement ) ) {
109109 activeDOM . focus ( ) ;
110110 }
111111 }
112112 }
113- }
113+ }
114+
0 commit comments