To prevent click bubbling using action: "None"
, you must not call clickArgs.preventDefault()
in the onClick
handler. Calling preventDefault()
prevents the action
from being processed.
args.data.areas = [{
visibility: "Hover",
action: "None",
width: 15,
height: 15,
top: 0,
left: 5,
html: "<em class='fas fa-info'></em>",
onClick: (clickArgs: any): void => {
//my code
}
}];
You can also work with the original JavaScript event object in onClick
. You can access it as clickArgs.originalEvent
.
args.data.areas = [{
visibility: "Hover",
width: 15,
height: 15,
top: 0,
left: 5,
html: "<em class='fas fa-info'></em>",
onClick: (clickArgs: any): void => {
clickArgs.originalEvent.stopPropagation();
//my code
}
}];