@vention/machine-logic-ui-sdk 0.47.9 → 0.47.10
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/index.esm.js +10 -0
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -2269,6 +2269,10 @@ const VirtualKeyboard = () => {
|
|
|
2269
2269
|
setIsSubmitPressed(false);
|
|
2270
2270
|
return;
|
|
2271
2271
|
}
|
|
2272
|
+
}
|
|
2273
|
+
// On touch, touchend fires before the tapped element takes focus, so the input would still look focused there.
|
|
2274
|
+
// click fires once focus has moved, for both mouse and touch.
|
|
2275
|
+
function closeOnClickOutside(event) {
|
|
2272
2276
|
if (keyboardContainerRef.current && !keyboardContainerRef.current.contains(event.target) && (document.activeElement == null || document.activeElement.tagName !== "INPUT")) {
|
|
2273
2277
|
setIsKeyboardVisible(false);
|
|
2274
2278
|
}
|
|
@@ -2284,9 +2288,15 @@ const VirtualKeyboard = () => {
|
|
|
2284
2288
|
}
|
|
2285
2289
|
document.addEventListener("pointerup", handleNonTouchPointerUp);
|
|
2286
2290
|
document.addEventListener("touchend", handleMouseOrTouchUp);
|
|
2291
|
+
document.addEventListener("click", closeOnClickOutside, {
|
|
2292
|
+
capture: true
|
|
2293
|
+
});
|
|
2287
2294
|
return () => {
|
|
2288
2295
|
document.removeEventListener("pointerup", handleNonTouchPointerUp);
|
|
2289
2296
|
document.removeEventListener("touchend", handleMouseOrTouchUp);
|
|
2297
|
+
document.removeEventListener("click", closeOnClickOutside, {
|
|
2298
|
+
capture: true
|
|
2299
|
+
});
|
|
2290
2300
|
};
|
|
2291
2301
|
}, [isSubmitPressed]);
|
|
2292
2302
|
useEffect(function showKeyboard() {
|