Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Transitions never finish for hidden elements #2062

Closed
@alexreardon

Description

@alexreardon

file: transition.js
If an element is not visible then the transitionEnd events will never file.

Quick fix - uses jQuery is:('visible')


// Wrap in a timeout to allow the browser time to update the DOM before the transition is to occur
$timeout(function () {
    if (angular.isString(trigger)) {
        element.addClass(trigger);
    } else if (angular.isFunction(trigger)) {
        trigger(element);
    } else if (angular.isObject(trigger)) {
        element.css(trigger);
    }
    //If browser does not support transitions, instantly resolve
    if (!endEventName) {
        deferred.resolve(element);

        // new
        return;
    }

    /***** NEW:  *******/
    // Invisible elements
    // if element is not visible then transitionEnd will never fire as animation will not occur
    // need to manually resolve the transition
    if (!element.is(':visible')) {
        transitionEndHandler();
    }
});

This fix requires jQuery .is(':visible') however I am sure there would be a jqlite work around.

Example of problem:
If you start a collapse on an element that is hidden then the collapsing class will be added, but it will never be removed and replaced with collapse in.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions