MouseEvent.altKey is a read-only boolean on each mouse event: true if Alt (Option on Mac) was held when the event fired. Learn how to read it, build Alt+click shortcuts, set it on synthetic events, and compare it with other modifiers.
01
Kind
Instance property
02
Returns
Boolean
03
Status
Baseline Widely available
04
Access
event.altKey
05
Mac name
Option key
06
Family
Modifier keys
Fundamentals
Introduction
When a user clicks while holding a modifier key, your handler often needs a different action—for example Alt+click to open a detail panel. The browser stores that state on the event object as altKey.
On Mac keyboards this is the Option key. Same property name: event.altKey.
JavaScript
element.addEventListener("click", (event) => {
console.log(event.altKey); // true or false
});
💡
Beginner tip
altKey is read from the event instance that arrived in your listener—not from the MouseEvent constructor itself (unlike the WebKit Force Touch statics).
Concept
Understanding the Property
MDN: MouseEvent.altKey is a read-only boolean that indicates whether the Alt key was pressed when a given mouse event occurred.
Instance — read event.altKey inside a handler.
Boolean — true pressed, false not pressed.
Read-only — you do not assign to it on a live user event.
Platform note — some Linux setups use Alt+click for window move/resize, so detection can fail.
Foundation
📝 Syntax
JavaScript
const isAltHeld = mouseEvent.altKey;
Value
A boolean: true if Alt/Option was held during the event; otherwise false.
MouseEvent.altKey is Baseline Widely available across modern browsers (MDN: since July 2015). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
MouseEvent.altKey
Reliable boolean for Alt/Option during mouse events. Still mind OS-level Alt+click conflicts on some Linux setups.
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported in modern IE versions
Full support
altKeyExcellent
Bottom line: Read event.altKey in mouse handlers; set altKey in MouseEvent options for tests.
Wrap Up
Conclusion
event.altKey tells you whether Alt/Option was held for that mouse event. Use it for Alt+click shortcuts, and set altKey on synthetic MouseEvent objects when testing.
Assume Alt+click always reaches the page on every Linux WM
Confuse instance altKey with WebKit static Force Touch constants
Rely only on hidden modifier shortcuts for critical actions
Forget Mac users know the key as Option
Mutate event.altKey on live user events
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about altKey
Boolean Alt/Option state on every mouse event.
5
Core concepts
🖱️01
Instance
on the event
Kind
✅02
Boolean
true / false
Type
🍎03
Mac Option
same property
Platform
🔧04
Synthetic OK
options.altKey
Tests
🛡️05
Baseline
widely available
Status
❓ Frequently Asked Questions
It is a read-only boolean on a mouse event that is true when the Alt key (Option on Mac) was held down at the time of that event, and false otherwise.
No. MDN marks MouseEvent.altKey as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard, so no status warning banner is needed.
Yes. On Macintosh keyboards the Alt key is also called the Option key. MouseEvent.altKey reports that modifier.
MDN notes that some OSes reserve Alt+click for window move/resize, so the browser cannot always detect Alt during a mouse event. Treat Alt+click shortcuts carefully across platforms.
Pass altKey: true in the options object to new MouseEvent("click", { altKey: true }). The constructed event then reports event.altKey as true.
Mouse events also expose ctrlKey, shiftKey, and metaKey. Together they describe which modifier keys were held. You can also use event.getModifierState("Alt") for a related check.
Did you know?
MDN warns that on some Linux variants, Alt + left click is reserved for moving or resizing windows. Your page may never see that combination—so critical features should not depend on Alt+click alone.