Better Context Menus With Safe Triangles

Better Context Menus With Safe Triangles
May 2020By The Coding Company Team6 min readWeb Development

Better Context Menus With Safe Triangles

Ever had a submenu close just as you reached for it? A small “safe triangle” technique fixes this frustrating detail.

You open a menu, move your mouse toward a submenu, and the submenu disappears because your cursor briefly crossed another item. It is a small annoyance, but it makes an interface feel clumsy.

Why it happens

Most menus open a submenu when you hover an item and close it as soon as you hover a different one. People rarely move the mouse in a perfect straight line, so the cursor often touches a neighboring item on the way, and the submenu closes.

The safe triangle idea

Imagine a triangle between the cursor’s current position and the two nearest corners of the open submenu. While the cursor stays inside that triangle, the user is clearly heading towards the submenu, so the menu should stay open instead of switching to the item underneath.

  • Track the cursor position as the pointer leaves the parent item
  • Check whether it is moving inside the triangle towards the submenu
  • If yes, delay switching items; if not, switch immediately
Good interaction design is mostly removing tiny moments of friction users never think to complain about.

A simpler alternative

If tracking the pointer feels like too much, a short close delay of 100 to 200 milliseconds solves most cases. Use the triangle when your menus are large or deeply nested and every bit of polish matters.

Share:LinkedInXFacebook