Read the original at linear.app ↗linear.app
By Linear · linear.app
Linear shares how they implemented contextual menus with invisible safe areas that let users move their mouse diagonally to sub-menu items without the menu disappearing. The team recognized that the traditional L-shaped mouse path was unintuitive and slow, so they built a React component using triangle geometry and CSS clip-path to create a forgiving interaction zone. This small detail improves speed and reduces friction for mouse-based users, especially those taking hundreds of interactions daily.
01Key takeaways
- Invisible micro-interactions compound: fractions of seconds saved per action add up across hundreds of daily interactions.
- Use geometry to solve UX friction—diagonal (Euclidean) paths are always shorter than grid-based (Manhattan) paths.
- Safe zones in menus are a solved problem; apply proven patterns from native OS and established web apps to your product.
- Contextual menus double as onboarding tools by surfacing keyboard shortcuts alongside mouse actions.
- CSS clip-path enables elegant solutions for defining interactive regions without complex DOM manipulation.
02Key sections
- Why contextual menus matter
- Contextual menus speed up navigation for mouse users and serve as a discovery tool for keyboard shortcuts. Linear uses them to let users perform almost any action on an issue without leaving the mouse or keyboard.
- The problem with traditional sub-menus
- Original designs required an unintuitive L-shaped mouse path to reach sub-menu items. This was slower and frustrating because diagonal movement would cause the menu to close prematurely.
- The safe area solution
- Linear created an invisible triangle between the cursor and sub-menu using geometry and CSS clip-path. This allows users to move diagonally along the shortest path without triggering menu closure.
- Implementation approach
- The React component measures the sub-menu position, tracks mouse coordinates, and calculates a safe triangle zone using clip-path. The solution requires only ~40 lines of code and follows patterns used by Amazon and Khan Academy.
“It may only take a fraction to 1–2 seconds longer to move your mouse in an upside down L shape but the seconds add up.”Linear · linear.app
“The shortest distance will always be the Euclidian, or diagonal, distance compared to the Manhattan distance.”Linear · linear.app
03Frameworks mentioned
Summary and takeaways written by PM Atlas; quotes are short excerpts. © the original author.