TypeError: Cannot read properties of undefined (reading 'startsWith')
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 99
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 6
Description
We are observing a `TypeError` from this line:
```.ts
const elideShift = event.code.startsWith('Key') && event.shiftKey && event.key.toUpperCase() === event.key;
```
See: [Sentry](https://sentry.io/organizations/github/issues/?project=1890375&query=is%3Aunresolved+github%2Fhotkey&sort=new&statsPeriod=1h)
Though this was first seen 9 months ago, looks like there has been a recent spike.
Contributor guide
Research direction
Use the reported event.code.startsWith line as the entry point; trace how keyboard events reach it and determine why event.code can be undefined. Confirm the expected handling with a reproduction or regression test for the reported case, and verify that it no longer throws a TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100