-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[this._focusTrap is null] Or [Cannot read property 'destroy' of null] When calling close()
#2372
Comments
TypeError: this._focusTrap is null
When calling close()
close()
close()
close()
@benouat could you try to dig into it to see what is going on? |
@pkozlowski-opensource sure i'll have a look. This might be fixed in #2328 which implements another way of handling focustrap. |
@akram1905 I suspect the The autofocus feature on the datepicker will by default (and we did not make it available via config) put the focus back on the element that was previously focused just before opening. In your case the input, which listen on focus to open the datepicker again. Hence the crash, and also the fact that you need to click twice somehow. On top of that, focustrap is using internally Be aware that for example, if you simply replace I would not recommend to open anything on focus, mainly for accessibility, it's better to announce that user can open something by triggering an action (like click) instead of having it to be open magically on navigation. Nonetheless, I'll try to make this scenario work for sure ! Thanks for the report. |
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore Fixes ng-bootstrap#2406 Fixes ng-bootstrap#2390 Fixes ng-bootstrap#2372 (one more time)
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore Fixes ng-bootstrap#2406 Fixes ng-bootstrap#2390 Fixes ng-bootstrap#2372 (one more time)
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore Fixes ng-bootstrap#2406 Fixes ng-bootstrap#2390 Fixes ng-bootstrap#2372 (one more time)
Bug description:
Sometimes, when calling
close()
error will be thrown.Error:
this._focusTrap is null
Link to minimally-working plunker that reproduces the issue:
https://stackblitz.com/edit/angular-hobhrq
Steps:
chrome: Cannot read property 'destroy' of null
FF: this._focusTrap is null
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 6.0.0
ng-bootstrap: 2.0.0
Bootstrap: 4.1.1
The text was updated successfully, but these errors were encountered: