@@ -31,7 +31,7 @@ interface InertHTMLElement extends HTMLElement {
3131}
3232
3333/**
34- Compiles a list of nodes that can be focused. Walkes the tree, discardes hidden elements and a few edge cases. To calculate the right.
34+ Compiles a list of nodes that can be focused. Walks the tree, discards hidden elements and a few edge cases. To calculate the right.
3535 @private
3636 @param {Element } root the root element to start traversing on
3737 @returns {Array } list of focusable nodes
@@ -43,7 +43,7 @@ function compileFocusAreas(root: Element = document.body) {
4343 throw new Error ( 'Element must be in the DOM' ) ;
4444 }
4545
46- let activeElment = getActiveElement ( ownerDocument ) ;
46+ let activeElement = getActiveElement ( ownerDocument ) ;
4747 let treeWalker = ownerDocument . createTreeWalker (
4848 root ,
4949 NodeFilter . SHOW_ELEMENT ,
@@ -76,13 +76,13 @@ function compileFocusAreas(root: Element = document.body) {
7676 }
7777
7878 // Always accept the 'activeElement' of the document, as it might fail the next check, elements with tabindex="-1"
79- // can be focused programtically , we'll therefor ensure the current active element is in the list.
80- if ( node === activeElment ) {
79+ // can be focused programmatically , we'll therefor ensure the current active element is in the list.
80+ if ( node === activeElement ) {
8181 return NodeFilter . FILTER_ACCEPT ;
8282 }
8383
8484 // UA parses the tabindex attribute and applies its default values, If the tabIndex is non negative, the UA can
85- // foucs it.
85+ // focus it.
8686 return node . tabIndex >= 0
8787 ? NodeFilter . FILTER_ACCEPT
8888 : NodeFilter . FILTER_SKIP ;
@@ -173,14 +173,12 @@ function findNextResponders(root: Element, activeElement: HTMLElement) {
173173 </caption>
174174 tab({ backwards: true });
175175*/
176- export default function triggerTab ( options ?: {
177- backwards : boolean ;
178- unRestrainTabIndex : boolean ;
179- } ) : Promise < void > {
176+ export default function triggerTab ( {
177+ backwards = false ,
178+ unRestrainTabIndex = false ,
179+ } = { } ) : Promise < void > {
180180 return Promise . resolve ( )
181181 . then ( ( ) => {
182- let backwards = ( options && options . backwards ) || false ;
183- let unRestrainTabIndex = ( options && options . unRestrainTabIndex ) || false ;
184182 return triggerResponderChange ( backwards , unRestrainTabIndex ) ;
185183 } )
186184 . then ( ( ) => {
@@ -190,7 +188,7 @@ export default function triggerTab(options?: {
190188
191189/**
192190 @private
193- @param {boolean } backwards when `true` it selects the previous foucs area
191+ @param {boolean } backwards when `true` it selects the previous focus area
194192 @param {boolean } unRestrainTabIndex when `true`, will not throw an error if tabindex > 0 is encountered
195193 @returns {Promise<void> } resolves when all events are fired
196194 */
0 commit comments