I am using React-hotkeys for the keyboard shortcuts on a React project. GlobalHotKeys not working when focused on the input field. Please help me, I am unable to find out what I am missing.
Demo (Recorded Screen Link): https://recordit.co/ffVKvn9uVw
<GlobalHotKeys keyMap={REGISTRATION_KEY_MAP} handlers={this.handlers}>
<RegistrationForm
ref={regFormRef}
onBillClick={this.onBillClick}
patientId={this.state.patientID}
openBill={this.state.openBill}
/>
</GlobalHotKeys>
const handlers = {
REGISTER: () => console.log(regFormRef),
REGISTER_AND_BILL: () => console.log(regFormRef),
};
const REGISTRATION_KEY_MAP = {
REGISTER: ['command+enter', 'ctrl+enter'],
REGISTER_AND_BILL: ['enter'],
};
Expected behavior
If I am using then it should directly fire the related action, the focus should not matter. Eg. I want to submit a form but currently, document focused on any input box then it should submit the form
Platform:
- Version of react-hotkeys:
react-hotkeys v2.0.0
- Browser chrome
- OS: iOS v10.13.6