'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const handleInteractiveKeyEvent = (callback) => (e) => {
    const targetIsNotChild = e.target === e.currentTarget;
    // Prevent scrolling the page when user press " "
    if (e.key === ' ' && targetIsNotChild) {
        e.preventDefault();
    }
    if (e.key === ' ' || e.key === 'Enter') {
        callback();
    }
};

exports.handleInteractiveKeyEvent = handleInteractiveKeyEvent;
