fix(focus-trap): avoid closure compiler issues when adding anchors (#3448)

This commit is contained in:
Kristiyan Kostadinov
2017-03-06 18:24:48 +01:00
committed by Kara
parent 02f4bc3730
commit 8b2ae0d8aa
+4 -6
View File
@@ -72,13 +72,11 @@ export class FocusTrap {
}
this._ngZone.runOutsideAngular(() => {
this._element
.insertAdjacentElement('beforebegin', this._startAnchor)
.addEventListener('focus', () => this.focusLastTabbableElement());
this._startAnchor.addEventListener('focus', () => this.focusLastTabbableElement());
this._endAnchor.addEventListener('focus', () => this.focusFirstTabbableElement());
this._element
.insertAdjacentElement('afterend', this._endAnchor)
.addEventListener('focus', () => this.focusFirstTabbableElement());
this._element.parentNode.insertBefore(this._startAnchor, this._element);
this._element.parentNode.insertBefore(this._endAnchor, this._element.nextSibling);
});
}