W3cubDocs

/Web APIs

MouseEvent: getModifierState() method

The MouseEvent.getModifierState() method returns the current state of the specified modifier key: true if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false.

See KeyboardEvent.getModifierState() for details.

Syntax

js

getModifierState(key)

Parameters

key

A modifier key value. The value must be one of the KeyboardEvent.key values which represent modifier keys or "Accel" Deprecated . This is case-sensitive.

Return value

A boolean value.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
getModifierState 47 12 15 9 34 12.1 47 47 15 34 12.2 5.0
accel_support No No 32 No No No No No 32 No No No

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/getModifierState