@firestitch/form 13.3.4 → 13.3.5

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.
@@ -483,21 +483,26 @@ class FsFormDirective {
483
483
  }
484
484
  });
485
485
  }
486
+ _activeDialog(el, dialog) {
487
+ if (el.isSameNode(dialog)) {
488
+ return true;
489
+ }
490
+ else if (el.parentElement) {
491
+ return this._activeDialog(el.parentElement, dialog);
492
+ }
493
+ return false;
494
+ }
486
495
  _listenHotKeys() {
487
496
  this._ngZone.runOutsideAngular(() => {
488
497
  fromEvent(document, 'keydown')
489
498
  .pipe(takeUntil(this._destroy$))
490
499
  .subscribe((event) => {
491
500
  if (this._dialogBackdropEscape && event.code === 'Escape') {
492
- const dialog = document.getElementById(this._dialogRef.id);
493
- const paths = event.composedPath();
494
- if (paths) {
495
- paths.forEach((item) => {
496
- if (dialog === item) {
497
- this._ngZone.run(() => {
498
- this._formClose();
499
- });
500
- }
501
+ const activeDialog = this
502
+ ._activeDialog(document.activeElement, document.getElementById(this._dialogRef.id));
503
+ if (activeDialog) {
504
+ this._ngZone.run(() => {
505
+ this._formClose();
501
506
  });
502
507
  }
503
508
  }