@rnacanvas/utilities 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,3 +28,28 @@ hasFocus(document.activeElement); // true
|
|
|
28
28
|
hasFocus(document.createElement('div')); // false
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## `function containsFocus()`
|
|
32
|
+
|
|
33
|
+
The `containsFocus()` function returns `true` if and only if
|
|
34
|
+
the passed in node contains the active element of the document
|
|
35
|
+
(or is the active element of the document).
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
var ele1 = document.createElement('div');
|
|
39
|
+
var ele2 = document.createElement('div');
|
|
40
|
+
|
|
41
|
+
// element 1 contains element 2
|
|
42
|
+
ele1.append(ele2);
|
|
43
|
+
|
|
44
|
+
// make elements focusable
|
|
45
|
+
ele1.tabIndex = '0';
|
|
46
|
+
ele2.tabIndex = '0';
|
|
47
|
+
|
|
48
|
+
ele1.focus();
|
|
49
|
+
containsFocus(ele1); // true
|
|
50
|
+
containsFocus(ele2); // false
|
|
51
|
+
|
|
52
|
+
ele2.focus();
|
|
53
|
+
containsFocus(ele1); // true
|
|
54
|
+
containsFocus(ele2); // true
|
|
55
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnacanvas/utilities",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "General utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"ts-loader": "^9.5.1",
|
|
20
20
|
"typescript": "^5.3.3",
|
|
21
21
|
"webpack": "^5.89.0",
|
|
22
|
-
"webpack-cli": "^
|
|
22
|
+
"webpack-cli": "^6.0.1"
|
|
23
23
|
}
|
|
24
24
|
}
|