-
Notifications
You must be signed in to change notification settings - Fork 62
Object doesn't support property or method 'focus' #18
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
Comments
I think the I don't know how you ended up in a situation where One fix would be to check that if (
this.props.focusTrapOptions.returnFocusOnDeactivate !== false &&
this.previouslyFocusedElement && this.previouslyFocusedElement.focus
) {
this.previouslyFocusedElement.focus();
} I'm still curious, though, why this error is happening ... |
So, came back to update this. It seems, for some reason, in chrome, firefox, and safari that the |
Aha. That's an annoying trick of IE's. You can treat it by adding |
Sorry for the delay in my response. Adding `focusable="false"' did indeed fix the issue for me, thanks for that. I think I like the idea of adding the check. Although I would never have found this issue with my svg if it weren't for the exception. Maybe that is okay? |
Uh oh!
There was an error while loading. Please reload this page.
Hi there,
I am running into an issue on IE11 in which the user "closes" the
FocusTrap
component and I run into this exception:Object doesn't support property or method on 'focus'
Looking around the code, I notice I do not pass in
focusTrapOptions.returnFocusOnDeactivate
which is checked here incomponentWillUnmount()
.Since that prop is
undefined
it actually fails the!== false
comparison and the component attempts to callpreviouslyFocusedElement.focus
.I figure I could:
a. Just pass the prop in as false.
b. Change the check to be a little less strict on
false
.c. Provide a default value of false on the prop.
Any thoughts or completely different suggestions?
Thanks for your work on this!
The text was updated successfully, but these errors were encountered: