@carbon/ibm-products
Version:
Carbon for IBM Products
18 lines (15 loc) • 420 B
JavaScript
/**
* Copyright IBM Corp. 2020, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const checkForHoldingKey = (event, key) => {
// possible key inputs: altKey,ctrlKey,metaKey,shiftKey
if (key == 'cmd') {
return event.metaKey || event.ctrlKey;
} else {
return event[key];
}
};
export { checkForHoldingKey };