...
const ToggleRow = ({ option }) => {
const [active, setActive] = useState(false);
// onKeyDown function for handling enter (13) press
function handleToggle(e) {
e.keyCode === 13 && setActive(!active);
}
return (
<div className={styles.toggleRow}>
{option}
<label className={styles.toggle} tabIndex='0' onKeyDown={e => handleToggle(e)}> // add onKeyDown function
<input
...
view raw ToggleRow.js hosted with ❤ by GitHub