@mathscan/math-exercise-engine 1.2.1 → 1.2.2
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/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19378,16 +19378,14 @@ const ExerciseRenderer = React.forwardRef(({
|
|
|
19378
19378
|
setResetKey((k) => k + 1);
|
|
19379
19379
|
},
|
|
19380
19380
|
focusFirstInput: () => {
|
|
19381
|
-
const container = rootRef.current;
|
|
19381
|
+
const container = rootRef.current ?? document.querySelector(".math-exercise-renderer");
|
|
19382
19382
|
if (!container) return;
|
|
19383
|
-
const candidates =
|
|
19384
|
-
'input[type="text"], input[type="number"], textarea, select'
|
|
19383
|
+
const candidates = Array.from(
|
|
19384
|
+
container.querySelectorAll('input[type="text"], input[type="number"], textarea, select')
|
|
19385
19385
|
);
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
return;
|
|
19390
|
-
}
|
|
19386
|
+
const canTakeInput = (el) => !el.readOnly && !el.disabled;
|
|
19387
|
+
const target = candidates.find(canTakeInput) ?? (locked ? void 0 : candidates[0]);
|
|
19388
|
+
target?.focus();
|
|
19391
19389
|
}
|
|
19392
19390
|
}), [json, values, onSubmit, playSound, locked]);
|
|
19393
19391
|
const handleChange = (widgetId, value, fromDrop = false, sourceOptionId) => {
|