diff --git a/docs/APIReference-KeyBindingUtil.md b/docs/APIReference-KeyBindingUtil.md index f3fc5af470..98da3ad7ec 100644 --- a/docs/APIReference-KeyBindingUtil.md +++ b/docs/APIReference-KeyBindingUtil.md @@ -28,6 +28,15 @@ isOptionKeyCommand: function( ): boolean ``` +### usesMacOSHeuristics + +``` +usesMacOSHeuristics: function(): boolean +``` + +Check whether heuristics that only apply to macOS are used internally, for +example when determining the key combination used as command modifier. + ### hasCommandModifier ``` diff --git a/src/component/utils/KeyBindingUtil.js b/src/component/utils/KeyBindingUtil.js index 179b89859b..ede7fba7c0 100644 --- a/src/component/utils/KeyBindingUtil.js +++ b/src/component/utils/KeyBindingUtil.js @@ -31,6 +31,10 @@ const KeyBindingUtil = { return isOSX && e.altKey; }, + usesMacOSHeuristics: function(): boolean { + return isOSX; + }, + hasCommandModifier: function(e: SyntheticKeyboardEvent<>): boolean { return isOSX ? !!e.metaKey && !e.altKey