Skip to content

Commit

Permalink
fix(focus-trap): avoid closure compiler issues when adding anchors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto authored and kara committed Mar 6, 2017
1 parent 02f4bc3 commit 8b2ae0d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib/core/a11y/focus-trap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down

0 comments on commit 8b2ae0d

Please sign in to comment.