Skip to content

Modal controlled by 'svg' element, when closing gets "no method 'focus'" error from 'restoreLastFocus()' #917

Closed

Description

@felix-d

Updated react-bootstrap from ^0.22.6 to ^0.23.5 and now get this error.

 TypeError: Object [ DIV#Test.Test.modal.fade ] has no method 'focus'
    at focusModalContent (node_modules/react-bootstrap/lib/Modal.js:314:20)

Activity

  1. changed the title [-]Modal has no method '[/-] [+]Modal has no method 'focus'[/+] on Jun 29, 2015
  2. jquense commented on Jun 29, 2015

    @jquense
    Member

    Hi here,

    can you provide a bit more context here for what you are doing and what the code looks like that triggers this error?

  3. oosthoek commented on Jul 9, 2015

    @oosthoek

    Hello,

    I also have this same error. i am using IE11, which does not support .focus() on svg elements.

  4. jquense commented on Jul 9, 2015

    @jquense
    Member

    I still don't really have enough info here...the original error posted is of the bootstrap controlled div not having a focus method, which is really odd b/c divs have focus methods. @oosthoek I am not sure where svg is coming from the modal doesn't render any svg elements, so you might be having a different error.

  5. oosthoek commented on Jul 9, 2015

    @oosthoek

    I'm sorry I'll be more specific. I have a svg element and when you click on it it opens a modal. when i try to close the modal i get the error from above which is from the restoreLastFocus function in Modal.js. this function calls .focus() on the element that had the focus before hand. I was able to temporarily fix this problem by setting the focus to a non svg element before i open the modal.

    Hope that was more clear.

  6. jquense commented on Jul 10, 2015

    @jquense
    Member

    Ok that makes more sense, definitely a bug.

  7. changed the title [-]Modal has no method 'focus'[/-] [+]Modal controlled by 'svg' element, when closing gets "no method 'focus'" error from 'restoreLastFocus()'[/+] on Jul 11, 2015
  8. added 3 commits that reference this issue on Jul 23, 2015
    de2d766
    6b2b606
    e5155c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions