@budibase/bbui 3.4.1 → 3.4.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/bbui",
3
3
  "description": "A UI solution used in the different Budibase projects.",
4
- "version": "3.4.1",
4
+ "version": "3.4.2",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.ts",
7
7
  "module": "dist/bbui.mjs",
@@ -99,5 +99,5 @@
99
99
  }
100
100
  }
101
101
  },
102
- "gitHead": "981ad8df214145efca562e441f1f9d1cf647d339"
102
+ "gitHead": "af99325eb2c8659214b1458b83fe7914c32efe5f"
103
103
  }
@@ -34,7 +34,7 @@ let candidateTarget: HTMLElement | undefined
34
34
  // Processes a "click outside" event and invokes callbacks if our source element
35
35
  // is valid
36
36
  const handleClick = (e: MouseEvent) => {
37
- const target = e.target as HTMLElement
37
+ const target = (e.target || e.relatedTarget) as HTMLElement
38
38
 
39
39
  // Ignore click if this is an ignored class
40
40
  if (target.closest('[data-ignore-click-outside="true"]')) {
@@ -91,9 +91,19 @@ const handleMouseDown = (e: MouseEvent) => {
91
91
  document.addEventListener("click", handleMouseUp, true)
92
92
  }
93
93
 
94
+ // Handle iframe clicks by detecting a loss of focus on the main window
95
+ const handleBlur = () => {
96
+ if (document.activeElement?.tagName === "IFRAME") {
97
+ handleClick(
98
+ new MouseEvent("click", { relatedTarget: document.activeElement })
99
+ )
100
+ }
101
+ }
102
+
94
103
  // Global singleton listeners for our events
95
104
  document.addEventListener("mousedown", handleMouseDown)
96
105
  document.addEventListener("contextmenu", handleClick)
106
+ window.addEventListener("blur", handleBlur)
97
107
 
98
108
  /**
99
109
  * Adds or updates a click handler