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

Hide the tooltip when its content becomes empty #875

Closed
merrihew opened this issue Aug 25, 2013 · 3 comments
Closed

Hide the tooltip when its content becomes empty #875

merrihew opened this issue Aug 25, 2013 · 3 comments
Milestone

Comments

@merrihew
Copy link

When the tooltip's content becomes empty (set to null), if the tooltip is currently open I think it should be closed. This is related to closed issue #129 , but it's different than the original issue and wasn't addressed in 030901e.

Here is my suggested modification to tooltip.js

attrs.$observe( type, function ( val ) {
    if ( !val && scope.tt_isOpen ) {
        hide();
        if ( angular.isDefined( scope.tt_animation ) && scope.tt_animation() ) {
            transitionTimeout = $timeout( function () { scope.tt_content = val; }, 500 );
        } else {
            scope.tt_content = val;
        }
    } else {
        scope.tt_content = val;
    }
});

Without the if/else statement the tooltip will momentarily become blank before hiding.

UPDATE (8/25): Added transitionTimeout conditional statement.

@pkozlowski-opensource
Copy link
Member

@merrihew Good catch! Would you be up to sending a pull request for this? We will need a test for this as well (so we don't accidentally remove this check in the future).

@merrihew
Copy link
Author

@pkozlowski-opensource I'm happy to put together a pull request once I can write out the test.

I updated my code to use the transitionTimeout to properly time the content change. However, the code I copied has a note: // FIXME: this is a placeholder for a port of the transitions library.
Is the above code the correct way to handle this (for now) until the transitions library is implemented? It's a pretty nasty looking if/else but keeps it the closest match to the same statement in hide(). Thoughts?

@fxck
Copy link

fxck commented Aug 26, 2013

Also wanted it on #559 was told it's duplicate of #590 which I believe was already implemented?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants