MouseEvent.metaKey is a read-only boolean: true if the Meta key was held when the mouse event fired. Learn Command vs Windows-key mapping, OS shortcut caveats, Command+click patterns, synthetic events, and five try-it labs.
01
Kind
Instance property
02
Returns
Boolean
03
Status
Baseline Widely available
04
Access
event.metaKey
05
Mac / Win
⌘ / ⊞
06
Family
modifier keys
Fundamentals
Introduction
On Mac, Command+click is the familiar “open related” / multi-select pattern. That key state is exposed as metaKey. On Windows, the same property tracks the Windows key—but the OS often claims that key for itself.
JavaScript
element.addEventListener("click", (event) => {
console.log(event.metaKey); // true or false
});
💡
Platform tip
MDN: on Macintosh keyboards Meta is Command (⌘); on Windows keyboards it is the Windows key (⊞). Many OSes bind special actions to Meta, so metaKey may stay false even while the key is pressed (for example opening the Start menu on Windows).
Concept
Understanding the Property
MDN: MouseEvent.metaKey is a read-only boolean that indicates whether the meta key was pressed when a given mouse event occurred.
Instance — read event.metaKey inside a handler.
Boolean — true pressed, false not pressed.
Read-only — set via constructor options on synthetic events.
OS may intercept — Meta often triggers system UI before your page sees it.
Foundation
📝 Syntax
JavaScript
const isMetaHeld = mouseEvent.metaKey;
Value
A boolean: true if Meta was held during the event; otherwise false.
MouseEvent.metaKey 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.metaKey
Reliable Meta modifier boolean—Command on Mac, Windows key on Windows (OS may intercept).
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
metaKeyExcellent
Bottom line: Read event.metaKey in mouse handlers; pair with ctrlKey for cross-platform power-clicks.
Wrap Up
Conclusion
event.metaKey tells you whether Meta was held for that mouse event—Command on Mac, Windows key on Windows. Use it for Command+click shortcuts, pair with ctrlKey for cross-platform power-clicks, and set metaKey on synthetic MouseEvent objects when testing.
Use metaKey || ctrlKey for cross-platform power-clicks
Test with new MouseEvent(..., { metaKey: true })
Remember Command (Mac) vs Windows key mapping
Offer a non-modifier UI path when possible
❌ Don’t
Assume the Windows key always reaches your page
Confuse Meta/Command with Control (ctrlKey)
Rely only on hidden modifier shortcuts for critical actions
Treat Meta as identical on every OS without testing
Mutate event.metaKey on live user events
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about metaKey
Boolean Meta / Command / Windows-key state on mouse events.
5
Core concepts
🖱️01
Instance
on the event
Kind
✅02
Boolean
true / false
Type
🍎03
⌘ / ⊞
Command / Win
Platform
🔧04
Synthetic OK
options.metaKey
Tests
🛡️05
Baseline
widely available
Status
❓ Frequently Asked Questions
It is a read-only boolean on a mouse event that is true when the Meta key was held down at the time of that event, and false otherwise. On Mac that is usually Command (⌘); on Windows it is the Windows key (⊞).
No. MDN marks MouseEvent.metaKey as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard, so no status warning banner is needed.
On Macintosh keyboards it is the Command key (⌘). On Windows keyboards it is the Windows key (⊞). Other platforms may map Meta differently.
MDN notes that many operating systems bind special functionality to the Meta key (for example opening the Start menu on Windows), so the property may stay false even when the key is physically pressed.
Pass metaKey: true in the options object to new MouseEvent("click", { metaKey: true }). The constructed event then reports event.metaKey as true.
They are different modifiers. Mac power-clicks often use Command (metaKey); Windows/Linux often use Control (ctrlKey). Checking ctrlKey || metaKey covers both platforms for many secondary-click patterns. You can also use event.getModifierState("Meta").
Did you know?
MDN warns that many operating systems bind special functionality to the Meta key, so metaKey may be false even when the key is actually pressed. On Windows, for example, that key may open the Start menu before your page ever sees the event—so always provide a non-Meta way to reach important actions.