venkat venkat - 10 months ago 38
Javascript Question

Left key postion not returning correct value on safari mac system?

When i am going to differentiate the shift key stroke on keyboard event, apple safari browser does not produce correct position to find out which key i am typing now whether it is left or right shift key. Is there any possibility to get the correct position value? But in case of other browsers produce one, two value for both keys respectively.


use this to get left and right shift it's working in Mac Safari also

if ( e.keyCode == 16 ) {
     if (e.originalEvent.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT){
               console.log('left Shift')
    else if (e.originalEvent.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT){
     console.log('right Shift')