Skip to content

Commit

Permalink
WIP Keyboard events on text inputs: remove redundent element path code
Browse files Browse the repository at this point in the history
Originally was getting the HTML element in question from the event path
but any events fired on this component are for this text area so there's
no need to use it.

If for any reason events fire here that are not ment for the textarea
then can introduce it back in for disambiguation.
  • Loading branch information
cdharris committed Jul 17, 2019
1 parent 196d8a1 commit cbfb450
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@ class TextArea extends React.Component<

// If the input event matches a control character we know how to handle, then handle it manually
private handleControlEvent(e: ReTargetedTextElementEvent) {
// Get the virtual target element this event was intended for, not the 'targetElement' that comes from the event
// that is actually the shadow dom root container.
const el = e.path[0]

switch (e.key) {
case 'Enter':
this.handleInput('\n')
Expand All @@ -362,10 +358,10 @@ class TextArea extends React.Component<
// moveSelectionUp(el);
return true
case 'End':
this.jumpSelection(el.value.length)
this.jumpSelection(this.textarea.value.length)
return true
case 'PageDown':
this.jumpSelection(el.value.length)
this.jumpSelection(this.textarea.value.length)
return true
case 'Home':
this.jumpSelection(0)
Expand Down

0 comments on commit cbfb450

Please sign in to comment.