From 26b83643f91855b407f39c2bec2fef1dbdede13b Mon Sep 17 00:00:00 2001 From: Vadim Demedes Date: Tue, 28 Mar 2023 22:01:48 +0300 Subject: [PATCH] Fix tab key incorrectly having `ctrl` equal to `true` Related to #512. --- src/hooks/use-input.ts | 2 +- test/fixtures/use-input.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/use-input.ts b/src/hooks/use-input.ts index c678dd8ea..3a92b45b3 100644 --- a/src/hooks/use-input.ts +++ b/src/hooks/use-input.ts @@ -155,7 +155,7 @@ const useInput = (inputHandler: Handler, options: Options = {}) => { }; // Copied from `keypress` module - if (input <= '\u001A' && !key.return) { + if (input <= '\u001A' && !key.return && !key.tab) { // eslint-disable-next-line unicorn/prefer-code-point input = String.fromCharCode( // eslint-disable-next-line unicorn/prefer-code-point diff --git a/test/fixtures/use-input.tsx b/test/fixtures/use-input.tsx index b03e7973f..6b39df1ce 100644 --- a/test/fixtures/use-input.tsx +++ b/test/fixtures/use-input.tsx @@ -61,7 +61,7 @@ function UserInput({test}: {test: string | undefined}) { return; } - if (test === 'tab' && input === '' && key.tab) { + if (test === 'tab' && input === '' && key.tab && !key.ctrl) { exit(); return; }