process-analytics / bpmn-visualization-js

A TypeScript library for visualizing process execution data on BPMN diagrams
https://process-analytics.github.io/bpmn-visualization-js/
Apache License 2.0
224 stars 31 forks source link

[BUG] Pointer events triggered from BPMN text label are ignored #920

Closed tbouffard closed 2 years ago

tbouffard commented 3 years ago

Describe the bug With #908, we have allowed integration to register event on HTML element related to BPMN elements of the diagram we display. But currently, the events seem ignored when they are triggered from the text label.

To Reproduce Create a demo like in #908 e0e47e8 (display an alert on click on a BPMN elements) When clicking on the text label of the BPMN element, nothing happens. You can also set it thanks to #1641 (styled applied on hover).

The following shows what is happening when clicking on the rest of the shape. Notice that when the mouse is over the text, the cursor changes (see #294) open an alert on clicking on a BPMN element

Expected behavior The behaviour should be the same whether the event occurs on the shape or on the text label.

Workaround Define a css selector targetting the bpmn-label class and setting the pointer-events property to none

.bpmn-label > g div {
  pointer-events: none !important;
}

image

Additional context ~This issue may have been the same root cause as #294~: no, see root cause in https://github.com/process-analytics/bpmn-visualization-js/issues/294#issuecomment-851979716.

~A mxgraph version bump (#919) may fix this issue: mxGraph 4.2.1 added "Fixes ignored pointerEvents flag for text in SVG" (https://github.com/jgraph/mxgraph/blob/master/ChangeLog) See https://github.com/jgraph/mxgraph/blame/v4.2.1/javascript/src/js/util/mxSvgCanvas2D.js#L1601 and https://github.com/process-analytics/mxgraph2/commit/1364dcda3ad10459e7702704018d395f5ba6f2d1.~ No, #1645 shows that this doesn't fix the issue.

laurentleseigneur commented 2 years ago

workaround is working as expected. Thanks!