focus-lock
Advanced tools
Comparing version 0.11.3 to 0.11.4
@@ -47,3 +47,10 @@ import { NEW_FOCUS, newFocus } from './solver'; | ||
if (newId === NEW_FOCUS) { | ||
return { node: pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache)) }; | ||
var focusNode = pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache)); | ||
if (focusNode) { | ||
return { node: focusNode }; | ||
} | ||
else { | ||
console.warn('focus-lock: cannot find any node to move focus into'); | ||
return undefined; | ||
} | ||
} | ||
@@ -50,0 +57,0 @@ if (newId === undefined) { |
import { NodeIndex } from './tabOrder'; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement | undefined; |
@@ -1,2 +0,2 @@ | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement; | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement | undefined; | ||
export declare const pickFocusable: (nodes: HTMLElement[], index: number) => number; |
@@ -38,3 +38,10 @@ import { NEW_FOCUS, newFocus } from './solver'; | ||
if (newId === NEW_FOCUS) { | ||
return { node: pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache)) }; | ||
const focusNode = pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache)); | ||
if (focusNode) { | ||
return { node: focusNode }; | ||
} | ||
else { | ||
console.warn('focus-lock: cannot find any node to move focus into'); | ||
return undefined; | ||
} | ||
} | ||
@@ -41,0 +48,0 @@ if (newId === undefined) { |
import { NodeIndex } from './tabOrder'; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement | undefined; |
@@ -1,2 +0,2 @@ | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement; | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement | undefined; | ||
export declare const pickFocusable: (nodes: HTMLElement[], index: number) => number; |
@@ -50,3 +50,10 @@ "use strict"; | ||
if (newId === solver_1.NEW_FOCUS) { | ||
return { node: (0, auto_focus_1.pickAutofocus)(anyFocusable, innerNodes, (0, parenting_1.allParentAutofocusables)(entries, visibilityCache)) }; | ||
var focusNode = (0, auto_focus_1.pickAutofocus)(anyFocusable, innerNodes, (0, parenting_1.allParentAutofocusables)(entries, visibilityCache)); | ||
if (focusNode) { | ||
return { node: focusNode }; | ||
} | ||
else { | ||
console.warn('focus-lock: cannot find any node to move focus into'); | ||
return undefined; | ||
} | ||
} | ||
@@ -53,0 +60,0 @@ if (newId === undefined) { |
import { NodeIndex } from './tabOrder'; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement; | ||
export declare const pickAutofocus: (nodesIndexes: NodeIndex[], orderedNodes: HTMLElement[], groups: Element[]) => HTMLElement | undefined; |
@@ -1,2 +0,2 @@ | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement; | ||
export declare const pickFirstFocus: (nodes: HTMLElement[]) => HTMLElement | undefined; | ||
export declare const pickFocusable: (nodes: HTMLElement[], index: number) => number; |
{ | ||
"name": "focus-lock", | ||
"version": "0.11.3", | ||
"version": "0.11.4", | ||
"description": "DOM trap for a focus", | ||
@@ -5,0 +5,0 @@ "main": "dist/es5/index.js", |
123391
2969