MouseEvent.shiftKey is a read-only boolean: true if Shift was held when the mouse event fired. Learn Shift+click patterns, how it sits next to other modifiers, synthetic events, and five try-it labs.
01
Kind
Instance property
02
Returns
Boolean
03
Status
Baseline Widely available
04
Access
event.shiftKey
05
Key
Shift ⇧
06
Family
modifier keys
Fundamentals
Introduction
Shift+click is a classic “extend selection” / alternate-action pattern in lists, file pickers, and toolbars. That key state is exposed as shiftKey on every mouse event.
JavaScript
element.addEventListener("click", (event) => {
console.log(event.shiftKey); // true or false
});
💡
Beginner tip
Hold Shift and click in a try-it lab. The property becomes true for that click only—release Shift and the next click is false again.
Concept
Understanding the Property
MDN: MouseEvent.shiftKey is a read-only boolean that indicates whether the shift key was pressed when a given mouse event occurred.
Instance — read event.shiftKey inside a handler.
Boolean — true pressed, false not pressed.
Read-only — set via constructor options on synthetic events.
Independent — works alongside Ctrl, Alt, and Meta flags.
Foundation
📝 Syntax
JavaScript
const isShiftHeld = mouseEvent.shiftKey;
Value
A boolean: true if Shift was held during the event; otherwise false.
MouseEvent.shiftKey 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.shiftKey
Reliable Shift modifier boolean for mouse events—great for range-select and alternate clicks.
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
shiftKeyExcellent
Bottom line: Read event.shiftKey in mouse handlers; use Shift+click for extend-selection and alternate actions.
Wrap Up
Conclusion
event.shiftKey tells you whether Shift was held for that mouse event. Use it for Shift+click range selection and alternate actions, and set shiftKey on synthetic MouseEvent objects when testing.
Document Shift shortcuts in your UI when they matter
Offer a non-modifier path for critical actions
❌ Don’t
Confuse Shift with Control or Meta
Assume left and right Shift need separate handling here
Rely only on hidden Shift shortcuts for critical actions
Forget that modifiers can combine (Shift+Ctrl+click)
Mutate event.shiftKey on live user events
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about shiftKey
Boolean Shift key state on mouse events.
5
Core concepts
🖱️01
Instance
on the event
Kind
✅02
Boolean
true / false
Type
⇧03
Shift
either key
Key
🔧04
Synthetic OK
options.shiftKey
Tests
🛡️05
Baseline
widely available
Status
❓ Frequently Asked Questions
It is a read-only boolean on a mouse event that is true when the Shift key was held down at the time of that event, and false otherwise.
No. MDN marks MouseEvent.shiftKey as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard, so no status warning banner is needed.
Range selection in lists and file trees, alternate toolbar actions, and “extend selection” UX. Your handler can branch with if (event.shiftKey) { … }.
Pass shiftKey: true in the options object to new MouseEvent("click", { shiftKey: true }). The constructed event then reports event.shiftKey as true.
It is independent of ctrlKey, altKey, and metaKey. Users can hold several at once (for example Shift+Ctrl+click). You can also use event.getModifierState("Shift").
A boolean: true means Shift was pressed during the event; false means it was not.
Did you know?
Shift+click for range selection is so common that users expect it in file lists and data tables. Detecting event.shiftKey is the first step—you still decide which item was the “anchor” of the range in your own app logic.