Skip to main content

Search and Top Navigation

#3532 closed bug (fixed)

Opened October 31, 2008 03:24PM UTC

Closed July 20, 2011 01:30PM UTC

Last modified November 21, 2011 01:20PM UTC

Accordion: Activating a panel during animation fails

Reported by: sunshine Owned by:
Priority: major Milestone: 1.9.0
Component: ui.accordion Version: 1.6rc2
Keywords: accordion animation ignore unintuitive Cc:
Blocked by: Blocking:
Description

Accordion's clickHandler() ignores animation requests if an animation is already in progress:

// if animations are still active, or the active header is
// the target, ignore click
if (options.running || (options.alwaysOpen && clickedActive)) {
  return false;
}

Unfortunately, this logic leads to very unintuitive behavior and perceived brokenness. Worse, since accordion("activate",...) is built atop clickHandler(), even programmatic requests to expand/collapse an item will be ignored if an animation is already active, thus accordion's state and response to programmatic actions essentially is indeterminate.

The problem manifests most obviously when the event option is set to "mouseover". Under the "mouseover" configuration, the widget behaves in a perceived ''broken'' fashion from both the user's and programmer's standpoint as described below.

  • If the user moves the mouse fast enough across the face of the accordion, events which should open items underneath the mouse are ignored. With accordion's default (hard-coded) ''slow'' durations, this issue manifests frequently, with even moderate speed of mouse movement. The result is that, when animation completes, the mouse very often is hovering over an unopened item (because the mouse's entry into the item was ignored). To the user, this is perceived as broken behavior since an accordion should always open the item over which the mouse is hovering.
  • I have a case where I need the accordion to revert to its original state if the mouse leaves the accordion's bounds. To accomplish this, I bind to "mouseleave" and have it invoke accordion("activate",...) in order to restore state. Unfortunately, since activation is built atop clickHandler(), the activation request often is ignored since animation frequently is in progress as the mouse leaves the accordion's bounds. Not only does this make the accordion's behavior inconsistent from the user's perspective, but it also makes it impossible to set the accordion to a known state programmatically.

Rather than ignoring new animation requests if animation already is in progress, there are better, more intuitive approaches. Some possibilities include:

  • Jump the current animation to its end state and then begin the new animation.
  • Chain the animations so that the newly requested one commences when the current one finishes.

Either solution would repair the reported problems: fixing the perceived brokenness and indeterminate behavior issue. If smoothness of animation is preferred, then chaining animations would be more appropriate than jumping the current animation to its end state.

Attachments (0)
Change History (9)

Changed November 09, 2008 05:48AM UTC by sunshine comment:1

Replying to [ticket:3532 sunshine]:

Rather than ignoring new animation requests if animation already is in progress, there are better, more intuitive approaches. Some possibilities include:

Another possibility is to allow in-progress animations to complete as usual with the exception that some in-progress animations may need to be reversed. For instance, as the mouse moves from expanded item 1 to item 2, item 1 begins to collapse and item 2 begins to expand. If the mouse then moves on to item 3 while the other animations are still in-progress, item 1 continues collapsing, item 2 immediately reverses and begins collapsing rather than expanding, and item 3 begins expanding. This seems like a preferable solution, providing smoother and more intuitive animation. (In fact, Moo.fx Accordion widget seems to behave in this fashion.)

Changed November 26, 2008 09:53PM UTC by jzaefferer comment:2

milestone: TBD1.next

Changed July 12, 2010 12:14PM UTC by scottgonzalez comment:3

milestone: 1.next1.9
summary: Accordion ignoring animation requestsAccordion: Activating a panel during animation fails

Changed July 14, 2010 07:37PM UTC by scottgonzalez comment:4

owner: joern.zaefferer
status: newassigned

Changed March 28, 2011 08:51PM UTC by scottgonzalez comment:5

status: assignedopen

Changed May 26, 2011 11:38PM UTC by jdart1 comment:6

http://jsfiddle.net/hTp9t/ example fiddle (modification of demo)

programmatically activating second panel, waiting briefly and then activating third panel. Because of issue, the third panel does not activate. change the timeout so the activation happens after the animation and you can see it changes properly.

Changed July 20, 2011 01:30PM UTC by kborchers comment:7

resolution: → fixed
status: openclosed

Accordion: Stop current hide animation, jump to last animation and calculate percentages for padding in addition to height. Fixes #3532 - Accordion: Activating a panel during animation fails

Changeset: 5f02a8ff1fb7947c40003208886214203b834ce1

Changed July 20, 2011 01:30PM UTC by Scott González comment:8

Merge pull request #368 from kborchers/bug_3532_2

Accordion: Stop current hide animation, jump to last animation and calculate percentages for padding in addition to height. Fixes #3532 - Accordion: Activating a panel during animation fails

Changeset: e2a9b0c5685852e3de50c31f0d842de2e5186292

Changed November 21, 2011 01:20PM UTC by scottgonzalez comment:9

#7901 is a duplicate of this ticket.