Last active
March 9, 2026 15:55
-
-
Save jonathantneal/cfc2849fc85fa0ebdc9494c21b34dfba to your computer and use it in GitHub Desktop.
accelKey for KeyboardEvent — 232 bytes / 166 bytes gzipped
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define the KeyboardEvent.accelKey getter as the platform modifier key | |
| KeyboardEvent.prototype.__defineGetter__( | |
| 'accelKey', | |
| KeyboardEvent.prototype.__lookupGetter__( | |
| // The modifier key is meta for Apple devices, otherwise control | |
| (navigator.platform ? /MacIntel|iPhone|iPad/.test(navigator.platform) : /iPad|iPhone|Mac OS X/.test(navigator.userAgent)) ? 'metaKey' : 'ctrlKey' | |
| ) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| KeyboardEvent.prototype.__defineGetter__("accelKey",KeyboardEvent.prototype.__lookupGetter__((navigator.platform?/MacIntel|iPhone|iPad/.test(navigator.platform):/iPad|iPhone|Mac OS X/.test(navigator.userAgent))?"metaKey":"ctrlKey")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment