-
-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useInput keys not responding properly (ctrl, backspace, shift) #512
Comments
Yeah it has a funny behaviour I just noticed this in MacOS. I could confirm these weird things:
Probably other stuff, I did not test everything... |
None of the modifier keys (e.g. shift, control, option or command) are expected to trigger a press event. They're only expected to trigger events when used in combination with "regular" keys. This matches the built in behavior of import readline from 'node:readline';
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);
process.stdin.on('keypress', (data, key) => {
console.log({ data, key });
if (key.name === 'q') {
process.exit(0);
return;
}
});
This also matches the
This and
this are bugs indeed. Will work on a fix. @jrson83 As for behavior on Linux or Windows, I don't have access to these OSes, so I'd appreciate a PR. |
Merged #576, so Ink should now parse keyboard the same as |
This is related to #409
There is something really wrong with the key detection.
ctrl & tab
For me on both linux and windows,
key.ctrl
doesn't get detected at all, when pressing ctrl.Instead when pressing
tab
, bothkey.tab
andkey.ctrl
getting detected.You can check with logging:
backspace & delete
key.del
gets detected when pressingdel
. But when pressingbackspace
it does not detectkey.backspace
, but insteadkey.del
.shift
When pressing
shift
it does not get detected at all.The text was updated successfully, but these errors were encountered: