@vention/machine-logic-ui-sdk 0.47.9 → 0.47.11

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.
Files changed (2) hide show
  1. package/index.esm.js +10 -0
  2. 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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vention/machine-logic-ui-sdk",
3
- "version": "0.47.9",
3
+ "version": "0.47.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/VentionCo/machine-cloud.git"