Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modal-window.ngOnDestroy() tries to apply focus unconditionaly #1627

Closed
zuloo opened this issue Jun 20, 2017 · 4 comments
Closed

modal-window.ngOnDestroy() tries to apply focus unconditionaly #1627

zuloo opened this issue Jun 20, 2017 · 4 comments

Comments

@zuloo
Copy link

zuloo commented Jun 20, 2017

Bug description:

if the modal was opened when an element was active, that does not support the focus method (i.e. SVGSVGElement in some IE versions), dismissing and closing the modal ends in an Exception, leaving the Backdrop opened and the app unusable.

I could only confirm this issue in some IE versions used within a corporation I work for, so no plunker for now - the dirty workaround is to focus document.body before opening the modal for now.

checking if this._elWithFocus actually has the focus method would solve the issue.

ngOnDestroy() {
  if ( this._elWithFocus && CHECKHERE && document.body.contains(this._elWithFocus)) {
    this._elWithFocus['focus'].apply(this._elWithFocus, []);
  } else {
    document.body['focus'].apply(document.body, []);
  }

  this._elWithFocus = null;
  this._renderer.removeClass(document.body, 'modal-open');
}

CHECKHERE could be this._elWithFocus.focus

@zuloo zuloo changed the title modal-window.ngOnDestroy() ties to apply focus unconditionaly modal-window.ngOnDestroy() tries to apply focus unconditionaly Jun 20, 2017
@pkozlowski-opensource
Copy link
Member

Sounds very much like #1618

@zuloo
Copy link
Author

zuloo commented Jun 21, 2017

indeed, it sounds like the same error message i got. And since the progress bar is SVG based it seems plausible.

@pkozlowski-opensource
Copy link
Member

Plunker with the reproduce scenario: http://plnkr.co/edit/HMJr7J8fRjF7OhAYXjHu?p=preview (taken from #1618)

@pkozlowski-opensource
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants