Dojo (HowTo)







  Easter Eggs




  Martial Arts

The beauty of "lag" effect

By:David K. Every
©Copyright 1999

Hysteresis means "lag of effect", or a delay before an action. This term comes from physics, where it means "a delay in in effect when forces on a body change" -- quite appropriate for user interface as well, as you will see.

Hysteresis is a very important part of menus and controls, even though most users are unaware of it.


In Menus, hysteresis is a time delay on hierarchical menus. When you select the sub-topic, the submenu pops out [see Hierarchical Menus for more].

It can be very hard to thread the cursor through the "small" area [see diagram]. If, while moving horizontally to hit a "choice", you were to accidentally move the mouse upwards, then you would be selecting the "Prev Item", and the submenu would disappear (until you went back over "sub-Topic"). If you were to allow the mouse to wander down a little while moving to the submenu, then "Next Item" would get selected, and the submenu would once again go away. Only by threading through the "small" area, can you get to the submenu (choices).

This "perfect" accuracy is annoying. So programmers put a time-delay (of a fraction of a second) where you can "miss" before the submenu goes away. This allows users to travel directly from sub-Topic to "choice-3" in a direct line [following the path of the arrow on the diagram] without the submenu "going away" -- even though the user will have selected "Next Item" for a brief amount of time. The time delay is quite small, so the move has to be pretty quick -- but without it, hierarchical menus would be far more annoying.

Apple's submenu Hysteresis is conditional on the mouse traveling in a right-down direction, if that is the way menus are arranged. If the Menu is large enough to be above the current menu item as well, then you will be allowed to travel upward without the submenu updating as well. In other words, it knows what makes sense, and it works.

Early Windows did not support menu-hysteresis, and hierarchical menus were a pain in the butt to use, but it has been fixed (poorly) in Win95. I was using a developers version of Rhapsody, and they had not yet implemented the hysteresis, and it was driving me nuts (it kept taking me 2 or 3 tries to hit any submenu item -- and I'm pretty good with a mouse).

More Menus

Another use of hysteresis in menuing can be seen when moving down menus that have multiple submenus. As you move down a list of sub-topics, the submenus will only be drawn (pop-out) if there is sufficient "pause" (or slowness to your moves).

By having submenus only come out if you are moving slowly (or you pause), it prevents an annoying "flickering" down the side of menus -- which would otherwise be distracting. It also prevents wasted CPU performance (because it doesn't have to draw all those silly menus -- which might otherwise drag on the mouse, and how fast you could move down a menu, because the screen refresh couldn't quite keep up). (This effect is implemented by a pure time delay, and works in the up or down direction). People don't notice these effects, unless it is pointed out to them -- but they would sure notice the results if they weren't there.

I have worked with machines that didn't use this type of hysteresis (the Amiga comes to mind), and it bugged me. Microsoft didn't do this right in the first versions of Windows, but Microsoft has implemented most of them by now. Of course implementing it, and implementing it well are two different things -- I personally find the pause before a submenu "pops out" to be too long in Windows, causing missed menus -- and some of the subtleties of hysteresis just not quite implemented as well.


When "using" various controls (or other parts of a Graphical User Interface) there is often a double-click action (users double-click the mouse button to do things). But mice wander a little, and double-clicking is pressing down on the mouse itself -- which is likely to make the mouse move.

So in controls, Hysteresis is an effect of allowing the mouse to "be off" by a little bit between clicks. So the mouse can move a couple of pixels, between the time of the first mouse click and the second, and if the two clicks were done fast enough, the "double-click" command will be accepted -- even though the mouse "wandered" a little.

The Mac supports a control-hysteresis. So double-clicking, with a little motion, is still acceptable. Windows does not support control-hysteresis well, and it is annoying. Theoretically there are parameters in the OS, that apps can use, if they want to create hysteresis, but Microsoft doesn't even document many of them, let alone encourage others to use them. So most Apps don't use them.

Watch Windows users double-click something and wait -- sometimes nothing happens and users don't know why. By and large, they just let the mouse "wander" a little in the explorer. They just double-click again, and usually only a few seconds are lost -- but it is an annoyance, and a loss of productivity. Sometimes they get so used to double-clicking twice, that they actually run the program twice. Over time this wasted efficiency ads up. Also users become frustrated, and usually double-click HARDER, which can help explain much higher failure rates on PC-Mice than on Mac mice.

Bad Hysteresis

Just because hysteresis can be implemented well, and can be useful, does not mean that it is always good. An example of bad hysteresis (time slop or lag) is in Microsoft Windows using contextual or popup menus. If you right click on a folder, or use the start menu, there can be a long pause while Windows creates the menu. Win98 is far worse than Win95, to the point at which in some bad cases (on fast machines) it can take many seconds (like up to 30) for your menu to actually appear. The lag is not just one time, it can do it for various stages in a hierarchy -- so if you try to get to the next level, it can "hang" for a while to create the submenu as well. This whole thing is aggravated by things like animated "sliding out" menus that assault you in Win98. Most of the time usage isn't that bad, but it can be, and it shouldn't exist at all. Microsoft gets so caught up in that they can creating wizzy features (like dynamically created menus, or animated menus), that they don't pay attention to usability and whether they even should create those features, or what the tradeoffs will be.

Microsoft has a long history, and proud corporate philosophy of "slap it together quick, then fix it later". They used to brag about this, and about how they are always bolting new features on (instead of designing them right the first time). Sadly, this attitude has qualitative costs throughout the system, and it shows in their implementations of hysteresis. Some Applications support only the pre-Win3 Hysteresis -- which was none. Most Applications support the post Win3 hysteresis -- which was some on menus, but that is about it. A few Applications even support the post-Win95 Hysteresis -- which is far more parameters (including controls). But Microsoft has not made most of the Hysteresis items standard, they haven't documented some of it well, they haven't enforced it as a standard, and so Hysteresis is only there some of the time and it behaves in dramatically different ways. The only thing worse than no hysteresis is inconsistent hysteresis.

Fortunately for Microsoft, most Windows users don't understand why things work "funky", and so they blame themselves (instead of Microsoft). Mac users know that things "don't work right" when using a PC, and they correctly blame Microsoft, but they usually can't explain why (so they get called bigots). But now we know that at least some of it has to do with Microsoft's poor and inconsistent use of hysteresis.


Hysteresis is basically "time" slop -- or even distance slop. It means the computer is actually being "less accurate" and allowing the mouse to be slightly off target, or a lag in redraw or update. But because humans are not perfectly accurate all the time, it is a way for the computer to adapt to working with people. Allowing hysteresis makes the computer "feel" more natural, by it behaving less accurately (and being more human). This "slop" is not dissimilar to another concept in computers called "fuzzy logic" -- which has helped improve many aspects of computing as well. Programmers are slowly learning to adapt computers to work better with humans, concepts like hysteresis are one step on the path -- but we still have a long way to go.

Created: 12/27/97
Updated: 11/09/02

Top of page

Top of Section