uicore-ts 1.1.385 → 1.1.386

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.
@@ -18,6 +18,7 @@ export declare class UIDialogView<ViewType extends UIView = UIView> extends UIVi
18
18
  willAppear(animated?: boolean): void;
19
19
  animateAppearing(): void;
20
20
  animateDisappearing(): void;
21
+ private static _setBackgroundInert;
21
22
  showInView(containerView: UIView, animated: boolean): void;
22
23
  showInRootView(animated: boolean): void;
23
24
  dismiss(animated?: boolean): void;
@@ -82,6 +82,16 @@ const _UIDialogView = class extends import_UIView.UIView {
82
82
  animateDisappearing() {
83
83
  this.style.opacity = "0";
84
84
  }
85
+ static _setBackgroundInert(containerView, inert) {
86
+ var _a;
87
+ for (const child of Array.from(containerView.viewHTMLElement.children)) {
88
+ const childElement = child;
89
+ if ((_a = childElement.UIViewObject) == null ? void 0 : _a._isAUIDialogView) {
90
+ continue;
91
+ }
92
+ childElement.inert = inert;
93
+ }
94
+ }
85
95
  showInView(containerView, animated) {
86
96
  this._fillsViewport = containerView.rootView == containerView;
87
97
  animated = animated && !import_ClientCheckers.IS_FIREFOX;
@@ -95,6 +105,9 @@ const _UIDialogView = class extends import_UIView.UIView {
95
105
  }
96
106
  }
97
107
  containerView.addSubview(this);
108
+ if (this._fillsViewport) {
109
+ _UIDialogView._setBackgroundInert(containerView, import_UIObject.YES);
110
+ }
98
111
  this.view.setNeedsLayoutUpToRootView();
99
112
  if (animated) {
100
113
  import_UIView.UIView.layoutViewsIfNeeded();
@@ -124,11 +137,15 @@ const _UIDialogView = class extends import_UIView.UIView {
124
137
  if (animated == void 0) {
125
138
  animated = this._appearedAnimated;
126
139
  }
127
- const unlockScroll = () => {
140
+ const containerView = this.superview;
141
+ const releaseViewportLocks = () => {
128
142
  if (this._fillsViewport) {
129
143
  _UIDialogView._activeDialogCount = Math.max(0, _UIDialogView._activeDialogCount - 1);
130
144
  if (_UIDialogView._activeDialogCount === 0) {
131
145
  document.body.style.overflow = "";
146
+ if (containerView) {
147
+ _UIDialogView._setBackgroundInert(containerView, import_UIObject.NO);
148
+ }
132
149
  }
133
150
  this.style.overflowY = "";
134
151
  }
@@ -141,7 +158,7 @@ const _UIDialogView = class extends import_UIView.UIView {
141
158
  }
142
159
  hasCompletedDismissal = import_UIObject.YES;
143
160
  this.removeFromSuperview();
144
- unlockScroll();
161
+ releaseViewportLocks();
145
162
  };
146
163
  import_UIView.UIView.animateViewOrViewsWithDurationDelayAndFunction(
147
164
  this,
@@ -161,7 +178,7 @@ const _UIDialogView = class extends import_UIView.UIView {
161
178
  new import_UIObject.UIObject().performFunctionWithDelay(this.animationDuration, completeDismissalIfNeeded);
162
179
  } else {
163
180
  this.removeFromSuperview();
164
- unlockScroll();
181
+ releaseViewportLocks();
165
182
  }
166
183
  this.isVisible = import_UIObject.NO;
167
184
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIDialogView.ts"],
4
- "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n super(elementID, viewHTMLElement)\n \n this.addSubview(this.view)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n\n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n this.style.overflowY = \"auto\"\n }\n }\n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil,\n \"opacity\"\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n\n if (!this.isVisible) {\n return\n }\n\n animated = (animated && !IS_FIREFOX)\n\n if (animated == undefined) {\n\n animated = this._appearedAnimated\n\n }\n\n const unlockScroll = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n }\n this.style.overflowY = \"\"\n }\n }\n\n if (animated) {\n\n // `transitionend` only fires when the CSS transition actually runs a\n // visible course - if this dialog is dismissed again shortly after\n // being shown (e.g. a server-pushed event auto-cancels a just-opened\n // confirmation), the opacity can revert to its starting value before\n // the browser ever paints the intermediate \"shown\" state, and the\n // browser correctly considers there to be nothing to transition -\n // `transitionend` then never dispatches for either transition. Without\n // a fallback, `removeFromSuperview` below (inside the transitionend\n // callback) would never run: `isVisible` correctly becomes NO, but the\n // dialog's DOM element is never actually removed, leaving it stuck\n // visibly open. `hasCompletedDismissal` makes the fallback a no-op\n // when the normal transitionend-driven removal already ran.\n let hasCompletedDismissal = NO\n const completeDismissalIfNeeded = () => {\n if (hasCompletedDismissal) {\n return\n }\n hasCompletedDismissal = YES\n this.removeFromSuperview()\n unlockScroll()\n }\n\n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n\n this.animateDisappearing()\n\n }).bind(this),\n () => {\n\n if (this.isVisible == NO) {\n\n completeDismissalIfNeeded()\n\n }\n\n },\n \"opacity\"\n )\n\n new UIObject().performFunctionWithDelay(this.animationDuration, completeDismissalIfNeeded)\n\n }\n else {\n\n this.removeFromSuperview()\n unlockScroll()\n\n }\n\n this.isVisible = NO\n\n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n if (event.name == UIView.broadcastEventName.PageDidScroll) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n super.layoutSubviews()\n \n }\n \n \n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAAsD;AACtD,0BAA6B;AAC7B,oBAA6C;AAGtC,MAAM,gBAAN,cAA6D,qBAAO;AAAA,EAavE,YAAY,WAAoB,iBAA+B;AAE3D,UAAM,WAAW,eAAe;AAbpC,4BAAmB;AACnB,iBAAkB,IAAI,qBAAO;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,qBAAqB;AACrB,iCAAwB;AAGxB,0BAAiB;AAMb,SAAK,WAAW,KAAK,IAAI;AAEzB,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,CAAC,QAAgB,UAAiB;AAE9B,aAAK,oBAAoB,QAAQ,KAAK;AAAA,MAE1C;AAAA,IACJ;AAEA,SAAK,kBAAkB,uBAAQ,cAAc,GAAG,IAAI,EAAE,EAAE,eAAe,IAAI;AAE3E,SAAK,SAAS,KAAK;AAAA,EAEvB;AAAA,EAGA,o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AEnC,SAAK,KAAK,eAAe;AAEzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AAjTO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
4
+ "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { LooseObject, UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n super(elementID, viewHTMLElement)\n \n this.addSubview(this.view)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n\n this.style.opacity = \"0\"\n\n }\n\n\n // Keeps everything behind an open, viewport-filling dialog unfocusable and unselectable via `inert`, while leaving any other dialog backdrop stacked alongside it interactive.\n private static _setBackgroundInert(containerView: UIView, inert: boolean) {\n\n for (const child of Array.from(containerView.viewHTMLElement.children)) {\n\n const childElement = child as HTMLElement & LooseObject\n\n if ((childElement.UIViewObject as any)?._isAUIDialogView) {\n continue\n }\n\n childElement.inert = inert\n\n }\n\n }\n\n\n showInView(containerView: UIView, animated: boolean) {\n\n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n\n this._appearedAnimated = animated\n\n this.willAppear(animated)\n\n\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n this.style.overflowY = \"auto\"\n }\n }\n\n containerView.addSubview(this)\n\n if (this._fillsViewport) {\n UIDialogView._setBackgroundInert(containerView, YES)\n }\n\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil,\n \"opacity\"\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n\n if (!this.isVisible) {\n return\n }\n\n animated = (animated && !IS_FIREFOX)\n\n if (animated == undefined) {\n\n animated = this._appearedAnimated\n\n }\n\n const containerView = this.superview\n\n const releaseViewportLocks = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n if (containerView) {\n UIDialogView._setBackgroundInert(containerView, NO)\n }\n }\n this.style.overflowY = \"\"\n }\n }\n\n if (animated) {\n\n // `transitionend` only fires when the CSS transition actually runs a\n // visible course - if this dialog is dismissed again shortly after\n // being shown (e.g. a server-pushed event auto-cancels a just-opened\n // confirmation), the opacity can revert to its starting value before\n // the browser ever paints the intermediate \"shown\" state, and the\n // browser correctly considers there to be nothing to transition -\n // `transitionend` then never dispatches for either transition. Without\n // a fallback, `removeFromSuperview` below (inside the transitionend\n // callback) would never run: `isVisible` correctly becomes NO, but the\n // dialog's DOM element is never actually removed, leaving it stuck\n // visibly open. `hasCompletedDismissal` makes the fallback a no-op\n // when the normal transitionend-driven removal already ran.\n let hasCompletedDismissal = NO\n const completeDismissalIfNeeded = () => {\n if (hasCompletedDismissal) {\n return\n }\n hasCompletedDismissal = YES\n this.removeFromSuperview()\n releaseViewportLocks()\n }\n\n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n\n this.animateDisappearing()\n\n }).bind(this),\n () => {\n\n if (this.isVisible == NO) {\n\n completeDismissalIfNeeded()\n\n }\n\n },\n \"opacity\"\n )\n\n new UIObject().performFunctionWithDelay(this.animationDuration, completeDismissalIfNeeded)\n\n }\n else {\n\n this.removeFromSuperview()\n releaseViewportLocks()\n\n }\n\n this.isVisible = NO\n\n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n if (event.name == UIView.broadcastEventName.PageDidScroll) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n super.layoutSubviews()\n \n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,qBAAwB;AACxB,oBAAuB;AACvB,gCAAmC;AACnC,sBAAsD;AACtD,0BAA6B;AAC7B,oBAA0D;AAGnD,MAAM,gBAAN,cAA6D,qBAAO;AAAA,EAavE,YAAY,WAAoB,iBAA+B;AAE3D,UAAM,WAAW,eAAe;AAbpC,4BAAmB;AACnB,iBAAkB,IAAI,qBAAO;AAE7B,6BAA4B;AAC5B,mBAAkB;AAClB,qBAAqB;AACrB,iCAAwB;AAGxB,0BAAiB;AAMb,SAAK,WAAW,KAAK,IAAI;AAEzB,SAAK;AAAA,MACD,qBAAO,aAAa;AAAA,MACpB,CAAC,QAAgB,UAAiB;AAE9B,aAAK,oBAAoB,QAAQ,KAAK;AAAA,MAE1C;AAAA,IACJ;AAEA,SAAK,kBAAkB,uBAAQ,cAAc,GAAG,IAAI,EAAE,EAAE,eAAe,IAAI;AAE3E,SAAK,SAAS,KAAK;AAAA,EAEvB;AAAA,EAGA,oBAAoB,QAAgB,OAAc;AAE9C,QAAI,MAAM,UAAU,KAAK,mBAAmB,KAAK,uBAAuB;AACpE,WAAK,QAAQ,KAAK,iBAAiB;AAA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B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AAtUjC,gBAAAD,KAAAC;AAsUoC,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,WAAC;AAAA,UACjD,qBAAO;AAAA,QACX,IAAI,qBAAO;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAEA,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AAEzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AA7UO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
6
6
  "names": ["_a", "_b"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uicore-ts",
3
- "version": "1.1.385",
3
+ "version": "1.1.386",
4
4
  "description": "UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework that is used in IOS. In addition, UICore has tools to handle URL based routing, array sorting and filtering and adds a number of other utilities for convenience.",
5
5
  "main": "compiledScripts/index.js",
6
6
  "types": "compiledScripts/index.d.ts",
@@ -4,7 +4,7 @@ import { UICore } from "./UICore"
4
4
  import { UINativeScrollView } from "./UINativeScrollView"
5
5
  import { FIRST, IF, IS, nil, NO, UIObject, YES } from "./UIObject"
6
6
  import { UIScrollView } from "./UIScrollView"
7
- import { UIView, UIViewBroadcastEvent } from "./UIView"
7
+ import { LooseObject, UIView, UIViewBroadcastEvent } from "./UIView"
8
8
 
9
9
 
10
10
  export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
@@ -105,22 +105,40 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
105
105
  }
106
106
 
107
107
  animateDisappearing() {
108
-
108
+
109
109
  this.style.opacity = "0"
110
-
110
+
111
111
  }
112
-
113
-
112
+
113
+
114
+ // Keeps everything behind an open, viewport-filling dialog unfocusable and unselectable via `inert`, while leaving any other dialog backdrop stacked alongside it interactive.
115
+ private static _setBackgroundInert(containerView: UIView, inert: boolean) {
116
+
117
+ for (const child of Array.from(containerView.viewHTMLElement.children)) {
118
+
119
+ const childElement = child as HTMLElement & LooseObject
120
+
121
+ if ((childElement.UIViewObject as any)?._isAUIDialogView) {
122
+ continue
123
+ }
124
+
125
+ childElement.inert = inert
126
+
127
+ }
128
+
129
+ }
130
+
131
+
114
132
  showInView(containerView: UIView, animated: boolean) {
115
133
 
116
134
  this._fillsViewport = containerView.rootView == containerView
117
135
  animated = (animated && !IS_FIREFOX)
118
-
136
+
119
137
  this._appearedAnimated = animated
120
-
138
+
121
139
  this.willAppear(animated)
122
-
123
-
140
+
141
+
124
142
  if (this._fillsViewport) {
125
143
  UIDialogView._activeDialogCount++
126
144
  if (UIDialogView._activeDialogCount >= 1) {
@@ -128,8 +146,13 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
128
146
  this.style.overflowY = "auto"
129
147
  }
130
148
  }
131
-
149
+
132
150
  containerView.addSubview(this)
151
+
152
+ if (this._fillsViewport) {
153
+ UIDialogView._setBackgroundInert(containerView, YES)
154
+ }
155
+
133
156
  this.view.setNeedsLayoutUpToRootView()
134
157
 
135
158
  if (animated) {
@@ -181,11 +204,16 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
181
204
 
182
205
  }
183
206
 
184
- const unlockScroll = () => {
207
+ const containerView = this.superview
208
+
209
+ const releaseViewportLocks = () => {
185
210
  if (this._fillsViewport) {
186
211
  UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)
187
212
  if (UIDialogView._activeDialogCount === 0) {
188
213
  document.body.style.overflow = ""
214
+ if (containerView) {
215
+ UIDialogView._setBackgroundInert(containerView, NO)
216
+ }
189
217
  }
190
218
  this.style.overflowY = ""
191
219
  }
@@ -212,7 +240,7 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
212
240
  }
213
241
  hasCompletedDismissal = YES
214
242
  this.removeFromSuperview()
215
- unlockScroll()
243
+ releaseViewportLocks()
216
244
  }
217
245
 
218
246
  UIView.animateViewOrViewsWithDurationDelayAndFunction(
@@ -243,7 +271,7 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
243
271
  else {
244
272
 
245
273
  this.removeFromSuperview()
246
- unlockScroll()
274
+ releaseViewportLocks()
247
275
 
248
276
  }
249
277