--- title: Mouse Button Modifiers Represent Intent, Not Physical Buttons impact: LOW impactDescription: Mouse modifiers .left/.right/.middle may not match physical buttons on left-handed mice or other input devices type: gotcha tags: [vue3, events, mouse, accessibility, modifiers] --- # Mouse Button Modifiers Represent Intent, Not Physical Buttons **Impact: LOW** - Vue's mouse button modifiers (`.left`, `.right`, `.middle`) are named based on a typical right-handed mouse layout, but they actually represent "main", "secondary", and "auxiliary" pointing device triggers. This means they may not correspond to physical button positions on left-handed mice, trackpads, or other input devices. ## Task Checklist - [ ] Understand that `.left` means "primary/main" action, not physical left button - [ ] Understand that `.right` means "secondary" action (usually context menu) - [ ] Consider accessibility when relying on specific mouse buttons - [ ] Don't assume users have a traditional right-handed mouse **Potentially Confusing:** ```html ``` **Clear Understanding:** ```html ``` ## What the Modifiers Actually Mean ```javascript // Vue modifier → MouseEvent.button value → Actual meaning // .left → button === 0 → "Main button" (primary action) // .right → button === 2 → "Secondary button" (context menu) // .middle → button === 1 → "Auxiliary button" (middle click) // The browser handles remapping for: // - Left-handed mouse settings // - Trackpad gestures // - Touch devices // - Stylus/pen input ``` ## Device Behaviors ```html ``` ## Best Practice: Semantic Naming in Comments ```html ``` ## Accessibility Considerations ```html ``` ## Reference - [Vue.js Event Handling - Mouse Button Modifiers](https://vuejs.org/guide/essentials/event-handling.html#mouse-button-modifiers) - [MDN - MouseEvent.button](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button)