-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Update useInput() to include name
in key
#674
base: master
Are you sure you want to change the base?
Conversation
Some key values (e.g. 'insert', 'home', 'end') were basically lost. In these cases, the `input` value would be an empty string and the generated `key` data would contain no additional information about the value. To resolve this, directly include `keypress.name` in the generated `key` data so this information is not lost.
Check if any types / docs needs to be updated. |
Update the `Key` type in src/hooks/use-input.ts to include the new `name` field. Update `useInput()` documentation for theh `inputHandler()` callback to include a description of the new `key.name`.
OK. I've update:
|
For cases where `parseKeypress()` does not provide `keypress.name` *and* `input` is not empty, set `keypress.name` to `input`.
I wonder if it would be better to instead expose a It's kinda weird to mix one letter presses like We could then even strongly type the property with the supported names: |
Some key values (e.g. 'insert', 'home', 'end') were basically lost. In these cases, the
input
value would be an empty string and the generatedkey
data would contain no additional information about the value.To resolve this, directly include
keypress.name
in the generatedkey
data so this information is not lost.