@instructure/ui-focusable 11.7.8 → 11.7.9-snapshot-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/CHANGELOG.md +8 -0
- package/lib/Focusable/index.js +8 -11
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-focusable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-focusable
|
package/lib/Focusable/index.js
CHANGED
|
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.Focusable = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
9
|
-
var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
|
|
10
|
-
var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
|
|
11
|
-
var _findFocusable = require("@instructure/ui-dom-utils/lib/findFocusable.js");
|
|
8
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
12
9
|
var _console = require("@instructure/console");
|
|
13
10
|
var _props = require("./props.js");
|
|
14
|
-
var
|
|
11
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
15
12
|
/*
|
|
16
13
|
* The MIT License (MIT)
|
|
17
14
|
*
|
|
@@ -75,7 +72,7 @@ class Focusable extends _react.Component {
|
|
|
75
72
|
focused
|
|
76
73
|
} = this;
|
|
77
74
|
this.addFocusableListeners(focused, focusable);
|
|
78
|
-
this._inputModeListener = (0,
|
|
75
|
+
this._inputModeListener = (0, _uiDomUtils.addInputModeListener)({
|
|
79
76
|
onInputModeChange: this.handleInputModeChange
|
|
80
77
|
});
|
|
81
78
|
this.setState({
|
|
@@ -126,9 +123,9 @@ class Focusable extends _react.Component {
|
|
|
126
123
|
addFocusableListeners(focused, focusable) {
|
|
127
124
|
if (!focusable) return;
|
|
128
125
|
if (focused && !this._blurListener) {
|
|
129
|
-
this._blurListener = (0,
|
|
126
|
+
this._blurListener = (0, _uiDomUtils.addEventListener)(focusable, 'blur', this.handleBlur, true);
|
|
130
127
|
} else if (!this._focusListener) {
|
|
131
|
-
this._focusListener = (0,
|
|
128
|
+
this._focusListener = (0, _uiDomUtils.addEventListener)(focusable, 'focus', this.handleFocus, true);
|
|
132
129
|
}
|
|
133
130
|
}
|
|
134
131
|
removeFocusableListeners() {
|
|
@@ -163,10 +160,10 @@ class Focusable extends _react.Component {
|
|
|
163
160
|
});
|
|
164
161
|
};
|
|
165
162
|
get focused() {
|
|
166
|
-
return (0,
|
|
163
|
+
return (0, _uiDomUtils.containsActiveElement)(this);
|
|
167
164
|
}
|
|
168
165
|
get focusable() {
|
|
169
|
-
const focusableArr = (0,
|
|
166
|
+
const focusableArr = (0, _uiDomUtils.findFocusable)(this, () => true, true) || [];
|
|
170
167
|
const focusableCount = focusableArr && focusableArr.length || 0;
|
|
171
168
|
(0, _console.logWarn)(focusableCount === 1, `[Focusable] Exactly one focusable child is required (${focusableCount} found).`);
|
|
172
169
|
const focusable = focusableArr ? focusableArr[0] : false;
|
|
@@ -231,7 +228,7 @@ class Focusable extends _react.Component {
|
|
|
231
228
|
attachRef: this.attachRef
|
|
232
229
|
});
|
|
233
230
|
return /*#__PURE__*/(0, _react.cloneElement)(rendered, {
|
|
234
|
-
ref: rendered.ref ? (0,
|
|
231
|
+
ref: rendered.ref ? (0, _uiUtils.createChainedFunction)(rendered.ref, this.attachRef) : this.attachRef
|
|
235
232
|
});
|
|
236
233
|
} else {
|
|
237
234
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-focusable",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A utility used to identify when an element receives focus.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/ui-utils": "11.7.
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-view": "11.7.
|
|
18
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-view": "11.7.9-snapshot-1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"vitest": "^5.0.0",
|
|
27
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
27
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=18 <=19"
|