microsoft / microsoft/react-native-windows

onKeyPress does not register 'Backspace' until the TextInput is empty

Open
#13,515 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Paper Area: TextInput bug Old Architecture Workstream: Component Parity
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

Not sure if this is by design or not, but when you are using backspace to clear text in a TextInput, the onKeyPress event doesnt fire until the length of the TextInput value is zero.

Delete doesn't fire onKeyPress ever.

Would be handy if these worked as we use the onKeyPress on our autocomplete control in windows.

Steps To Reproduce
  1. Add a TextInput to a page including onKeyPress.
  2. Add console.warn(e.nativeEvent.key); to the onKeyPress
  3. Add text, then delete it using backspace or delete
Expected Results

Expected result is to see onKeyPress fire on all keys.

CLI version

13.6.9

Environment
System:
  OS: Windows 11 10.0.22631
  CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13950HX
  Memory: 48.50 GB / 63.65 GB
Binaries:
  Node:
    version: 18.17.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.4
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 9.6.7
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.18362.0
      - 10.0.19041.0
      - 10.0.22000.0
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.8.34601.278 (Visual Studio Professional 2022)
Languages:
  Java: 11.0.18
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: 0.74.3
  react-native-windows:
    installed: 0.74.11
    wanted: 0.74.11
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

No response

Target Platform Version

None

Target Device(s)

No response

Visual Studio Version

None

Build Configuration

None

Snack, code example, screenshot, or link to a repository

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the TextInput onKeyPress behavior on Windows 11 with react-native-windows 0.74.11, using the Backspace and Delete steps described in the issue. Trace the TextInput event handling and verify that both keys emit the expected events while editing non-empty text; completion should include coverage for the reported behavior if a relevant test location is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.