Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
Just a suggestion for the WebDropDown animation code
posted

I realize full well that it's nice to be able to reverse the course of a drop-down list that is collapsing or expanding.

However, I think that the code to reverse the course of the animation should only run in cases where the user is clicking on the button or maybe using Alt-Up/Down.

The code in closeDropDown: function() starts out this way:

    closeDropDown: function() {
        if (this.behavior._dropDownAnimation && this.behavior._dropDownAnimation.get_isAnimating())
        {
            this.behavior._dropDownAnimation.stop();
            this.behavior._dropDownAnimation.onEnd();
            this.openDropDown();
            return;
        }

That's the code that reverses the course of the animation.

closeDropDown gets called from spots like __closeOnListBlur, though, and if a blur event happens to close in time to any other reason for closing the list (selection, for example), then it reverses course.

On a blur event, though, we just want it to keep closing, not bounce back.

I mention it because we have a spot where the selection and blur are fighting. The "bounce back" is not visible but keeps the behavior.get_visible() in the wrong state, occasionally causing effects like not opening the drop-down list when asked, and closing it right after opening.

I'd suggest maybe adding something like a canReverse parameter, which gets passed as true, e.g. make it this.openDropDown(true) in the __onMouseupHandler, and then rewriting the starts of openDropDown and closeDropDown somewhat like this:

    closeDropDown: function(canReverse) {

        if (canReverse && this.behavior._dropDownAnimation &&

            this.behavior._dropDownAnimation.get_isAnimating())
        {
            this.behavior._dropDownAnimation.stop();
            this.behavior._dropDownAnimation.onEnd();
            this.openDropDown();
            return;
        }

In the meantime, I'll probably have to disable the animations to get consistent functionality.

Cheers,

--=- Ritchie Annand