ProductiveRage / Bridge.React

Bindings for Bridge.NET for React - write React applications in C#!
MIT License
74 stars 14 forks source link

Add the list of "named" KeyboardEvent.key attribute values from the W3C uievents-key spec #33

Closed dionrhys closed 7 years ago

dionrhys commented 7 years ago

The KeyboardEvent.key attribute is the way forward to handling keyboard events in JS, and it's based on the UI Events and UI Events key specifications. React ensures that the property is poly-filled across browsers.

This pull request adds all the reserved "named key attribute values" from the UI Events key spec and plops them into a subclass of KeyboardEvent as string constants.

I was contemplating enum'ing these up sort of like ReactStyle's Display property values for example, but I chose not to because:

These named key values are currently being used internally on our Select Boxes, Search Box, and Date Picker components. I think it makes sense for these constants to be exposed by Bridge.React since they relate directly to KeyboardEvent.key, and this prevents us from duplicating the effort across projects.

ProductiveRage commented 7 years ago

I've looked through the changeset and it seems reasonable but also very happy to bow to the judgement of such a trusted contributor!