Closed hkupitz closed 1 year ago
Hi, thanks for opening the issue. I can reproduce the issue.
Pressing R
normally resets the token when token simulation is active, but in this case it creates a weird state where it is not active (toggle on top is off), but the token simulation UI is still visible.
I will move this ticket into backlog for now.
accelerator
) + editor action instead of a native keyboard event https://github.com/camunda/camunda-modeler-token-simulation-plugin/blob/master/menu.js#L23active
check is performed when pressing r
@marstamm I'm not sure if I agree on https://github.com/bpmn-io/bpmn-js-token-simulation/commit/9f1dc59a43b91ee6af19d8558fbb37f549f64010 to fix it given the root cause you provided.
Why don't we ensure that the shortcut is only emitted contextually in the app? Feel weird to fix it in the core.
I think the active/inactive state is inherently an internal token simulation state. An integrating library should be able to use the provided API safely without having to replicate this internal state.
Therefore, I think the correct fix is in the core, specifically in the EditorActions: https://github.com/bpmn-io/bpmn-js-token-simulation/commit/8ebee4445051e88efb76fd8b52068a2c5c2d230c
I have no strong feelings about https://github.com/bpmn-io/bpmn-js-token-simulation/commit/9f1dc59a43b91ee6af19d8558fbb37f549f64010 (overlays), and it is not needed to fix this issue. It was just weird to me that we would not have a check there as well, so I "fixed" it as well. If you think this is misplaced, we can drop it.
I think the active/inactive state is inherently an internal token simulation state. An integrating library should be able to use the provided API safely without having to replicate this internal state.
You could also argue the exact opposite:
I agree with you on https://github.com/bpmn-io/bpmn-js-token-simulation/commit/8ebee4445051e88efb76fd8b52068a2c5c2d230c as there is no meaningful way for any external component to drive this.
Let's go with https://github.com/bpmn-io/bpmn-js-token-simulation/commit/8ebee4445051e88efb76fd8b52068a2c5c2d230c then to prevent the invalid state from occurring
Describe the Bug
Pressing "R" on the keyboard when the "Token simulation" mode is disabled turns on simulation capabilities without hiding the palette or disabling the modeling mode.
Clicking the simulation mode toggle button twice resets the erroneous state back to default.
This only seems to be a bug with the Desktop Modeler plugin. Testing with
bpmn-js-token-simulation
itself or the C8 Web Modeler doesn't show this issue.Steps to Reproduce
Expected Behavior
Pressing "R" on the keyboard should do nothing when the simulation mode is disabled.
Environment