Comparing version 1.5.0 to 1.6.0
@@ -11,2 +11,4 @@ import inViewport from './src/dimension/in-viewport'; | ||
import focus from './src/element/focus'; | ||
import isFocusable from './src/element/is-focusable'; | ||
import isTabbable from './src/element/is-tabbable'; | ||
import parents from './src/element/parents'; | ||
@@ -43,2 +45,4 @@ import render from './src/element/render'; | ||
focus, | ||
isFocusable, | ||
isTabbable, | ||
parents, | ||
@@ -45,0 +49,0 @@ render, |
{ | ||
"name": "domestique", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "A modular DOM helper library.", | ||
@@ -30,5 +30,5 @@ "repository": "https://github.com/jsor/domestique.git", | ||
"browserslist": [ | ||
"Chrome >= 60", | ||
"Edge >= 15", | ||
"Firefox >= 54", | ||
"Chrome >= 61", | ||
"Edge >= 16", | ||
"Firefox >= 60", | ||
"iOS >= 10.3", | ||
@@ -61,4 +61,4 @@ "Safari >= 10.1" | ||
"build:test:browserstack": "webpack test/index.js --debug --mode none --progress --output test/build.js", | ||
"build:test:browserstack-legacy": "BROWSERSLIST='defaults, IE 10' webpack test/index.js --debug --mode none --progress --output test/build-legacy.js --module-bind 'js=babel-loader?presets[]=babel-preset-env'", | ||
"compat": "compat --recursive --target src/ test/ --jsEnvs chrome60 edge15 firefox54 ios10_3 safari10_1 --htmlEnvs chrome60 edge15 firefox54 ios_saf10.3 safari10.1", | ||
"build:test:browserstack-legacy": "BROWSERSLIST='defaults, IE >= 10' webpack test/index.js --debug --mode none --progress --output test/build-legacy.js --module-bind 'js=babel-loader?presets[]=babel-preset-env'", | ||
"compat": "compat --recursive --target src/ test/ --jsEnvs chrome61 edge16 firefox60 ios10_3 safari10_1 --htmlEnvs chrome61 edge16 firefox60 ios_saf10.3 safari10.1", | ||
"dev": "karma start", | ||
@@ -65,0 +65,0 @@ "lint": "xo", |
@@ -39,2 +39,4 @@ Domestique | ||
focus, | ||
isFocusable, | ||
isTabbable, | ||
parents, | ||
@@ -76,2 +78,4 @@ render, | ||
* [focus()](#focus) | ||
* [isFocusable()](#isfocusable) | ||
* [isTabbable()](#istabbable) | ||
* [parents()](#parents) | ||
@@ -295,2 +299,40 @@ * [render()](#render) | ||
#### isFocusable() | ||
``` | ||
isFocusable(element: Element): bool | ||
``` | ||
Checks whether an element is focusable. | ||
Unlike [`isTabbable()`](#istabbable), the function also returns `true` for | ||
elements which are not focusable by the keyboard, but only by script | ||
(`element.focus()`) and possibly the mouse (or pointer). Usually, those are | ||
elements with a negative `tabindex` attribute value, like `-1`. | ||
##### Example | ||
```javascript | ||
const isFocusableElement = isFocusable(element); | ||
``` | ||
#### isTabbable() | ||
``` | ||
isTabbable(element: Element): bool | ||
``` | ||
Checks whether an element is tabbable. | ||
Unlike [`isFocusable()`](#isfocusable), the function returns `true` **only** for | ||
elements which are focusable by the keyboard (by pressing the <kbd>TAB</kbd> and | ||
<kbd>SHIFT</kbd>+<kbd>TAB</kbd> keys). Elements that are only focusable by | ||
script (`element.focus()`) and possibly the mouse (or pointer) are excluded. | ||
##### Example | ||
```javascript | ||
const isFocusableElement = isFocusable(element); | ||
``` | ||
#### parents() | ||
@@ -297,0 +339,0 @@ |
38231
33
637
699