Skip to content

Disposing of detached tooltips inside of a modal causes errors when you close a modal #27577

@ambischof

Description

@ambischof

Found an Interesting bug:

Operating system: MacOS
Browser: Chrome 70.0.3538.77

JSFiddle: https://jsfiddle.net/anneb574/aq9Laaew/261755/
(or jsbin but it doesn't show what the error was)

If inside a modal, you create initialize a tooltipped element and then you detach that element and dispose of the tooltip, when you close the modal, it will cause an error:

tooltip.js:416 Uncaught TypeError: Cannot read property 'template' of null
    at Tooltip.getTipElement (tooltip.js:416)
    at Tooltip.hide (tooltip.js:349)
    at HTMLDivElement.<anonymous> (tooltip.js:493)
    at HTMLDivElement.dispatch (jquery-3.3.1.min.js:2)
    at HTMLDivElement.y.handle (jquery-3.3.1.min.js:2)
    at Object.trigger (jquery-3.3.1.min.js:2)
    at HTMLDivElement.<anonymous> (jquery-3.3.1.min.js:2)
    at Function.each (jquery-3.3.1.min.js:2)
    at w.fn.init.each (jquery-3.3.1.min.js:2)
    at w.fn.init.trigger (jquery-3.3.1.min.js:2)

I acknowledge that this is not the typical workflow (that is to detach the element before disposing of the tooltip) but when you're working with view frameworks, it sometimes happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions