Skip to content

TextField onKeyDown typescript event type is incorrect #12946

@Swazimodo

Description

@Swazimodo
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

A function with an event arg of type KeyboardEvent should for the onKeyDown event handler.

Current Behavior

This event handler expects KeyboardEvent which is counter intuitive.

Steps to Reproduce

<TextField
   onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {}}
/>

Context

I'm using typescript in our environment and some TextField events like onChange will use HTMLInputElement type but the key down event expected HTMLDivElement. I would have expected all event handlers to use the same types.

Your Environment

Tech Version
Material-UI v^1.1.0
React v^16.3.2
Chrome v68.0.3440.106
TypeScript v2.8.4

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions