diff --git a/js/accessibility/Accessibility.js b/js/accessibility/Accessibility.js index 18e647387..de529c514 100644 --- a/js/accessibility/Accessibility.js +++ b/js/accessibility/Accessibility.js @@ -561,7 +561,9 @@ define( function( require ) { assert && assert( this._accessibleVisible, 'trying to set focus on a node with invisible accessible content' ); assert && assert( this._accessibleInstances.length === 1, 'focus() unsupported for Nodes using DAG, accessible content is not unique' ); - this._accessibleInstances[ 0 ].peer.primarySibling.focus(); + var peer = this._accessibleInstances[ 0 ].peer; + assert && assert( peer, 'must have a peer to focus' ); + peer.focus(); } }, diff --git a/js/accessibility/AccessiblePeer.js b/js/accessibility/AccessiblePeer.js index 134936972..05fe9e196 100644 --- a/js/accessibility/AccessiblePeer.js +++ b/js/accessibility/AccessiblePeer.js @@ -291,6 +291,14 @@ define( function( require ) { return document.activeElement === this.primarySibling; }, + /** + * Focus the primary sibling of the peer. + */ + focus: function() { + assert && assert( this.primarySibling, 'must have a primary sibling to focus' ); + this.primarySibling.focus(); + }, + /** * Removes external references from this peer, and places it in the pool.