autogcd icon indicating copy to clipboard operation
autogcd copied to clipboard

KeyboardEvent fired as a result of SendKeys does not have all the fields set properly

Open shayanelhami opened this issue 8 years ago • 2 comments

When you issue a SendKey() the resulting keydown/keypress/keyup events do not have code, keyCode, which fields set.

Example: inputs[0].SendKeys("a") results in:

altKey:false
bubbles:true
cancelBubble:false
cancelable:true
charCode:0
code:""
composed:true
ctrlKey:false
currentTarget:null
defaultPrevented:false
detail:0
eventPhase:0
isComposing:false
isTrusted:true
key:"a"
keyCode:0
location:0
metaKey:false
path:Array(5)
repeat:false
returnValue:true
shiftKey:false
sourceCapabilities:InputDeviceCapabilities
srcElement:input#txt
target:input#txt
timeStamp:0
type:"keydown"
view:Window
which:0

whereas a real key generates:

altKey:false
bubbles:true
cancelBubble:false
cancelable:true
charCode:0
code:"KeyA"
composed:true
ctrlKey:false
currentTarget:null
defaultPrevented:false
detail:0
eventPhase:0
isComposing:false
isTrusted:true
key:"a"
keyCode:65
location:0
metaKey:false
path:Array(5)
repeat:false
returnValue:true
shiftKey:false
sourceCapabilities:InputDeviceCapabilities
srcElement:input#txt
target:input#txt
timeStamp:184020.115
type:"keydown"
view:Window
which:65

shayanelhami avatar May 28 '17 09:05 shayanelhami

Thanks for the report. I'll be honest, the key handling in autogcd is pretty garbage, I will look at re-writing it to be more standardized with how chromium actually handles key strokes.

wirepair avatar May 28 '17 23:05 wirepair

I temporally use EvaluateScript("$(#id).keydown()") to send key and trigger js functions

davyzhang avatar Jun 02 '17 02:06 davyzhang