javascript - event.preventDefault() Causing :active pseudo class to not work -
i have react-redux app in each button component in keyboard defined follows:
<button id={id} key={id} classname={classname} data-value={value} ontouchstart={handleaction}> {displayvalue} </button>
the handleaction
function defined follows:
let handleaction = (e) => { e.preventdefault(); onaction(value); };
the problem clicked
effect of button :active psuedo class not show when use e.preventdefault()
in handler. of note, if replace ontouchstart
onmousedown
:active
psuedo class works. how work ontouchstart
?
edit
basically, preventdefault
on ontouchstart
stops event cascading otherwise trigger onmousedown
event activates :active
psuedo-class. question boils down to, why :active
psuedo class not work ontouchstart
?
Comments
Post a Comment