camunda-bpmn-js 5.4.1 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10303,6 +10303,7 @@
10303
10303
  * deferUpdate?: boolean;
10304
10304
  * width?: number;
10305
10305
  * height?: number;
10306
+ * autoFocus?: boolean;
10306
10307
  * } } CanvasConfig
10307
10308
  * @typedef { {
10308
10309
  * group: SVGElement;
@@ -10489,18 +10490,20 @@
10489
10490
 
10490
10491
  attr(svg, 'tabindex', 0);
10491
10492
 
10492
- eventBus.on('element.hover', () => {
10493
+ config.autoFocus && eventBus.on('element.hover', () => {
10493
10494
  this.restoreFocus();
10494
10495
  });
10495
10496
 
10497
+ eventBus.on('element.mousedown', 500, (event) => {
10498
+ this.focus();
10499
+ });
10500
+
10496
10501
  svg.addEventListener('focusin', () => {
10497
- this._focused = true;
10498
- eventBus.fire('canvas.focus.changed', { focused: true });
10502
+ this._setFocused(true);
10499
10503
  });
10500
10504
 
10501
10505
  svg.addEventListener('focusout', () => {
10502
- this._focused = false;
10503
- eventBus.fire('canvas.focus.changed', { focused: false });
10506
+ this._setFocused(false);
10504
10507
  });
10505
10508
 
10506
10509
  append(container, svg);
@@ -10570,6 +10573,17 @@
10570
10573
  delete this._viewport;
10571
10574
  };
10572
10575
 
10576
+ Canvas.prototype._setFocused = function(focused) {
10577
+
10578
+ if (focused == this._focused) {
10579
+ return;
10580
+ }
10581
+
10582
+ this._focused = focused;
10583
+
10584
+ this._eventBus.fire('canvas.focus.changed', { focused });
10585
+ };
10586
+
10573
10587
  Canvas.prototype._clear = function() {
10574
10588
 
10575
10589
  const allElements = this._elementRegistry.getAll();
@@ -10594,10 +10608,12 @@
10594
10608
  };
10595
10609
 
10596
10610
  /**
10597
- * Sets focus on the canvas SVG element.
10598
- */
10611
+ * Sets focus on the canvas SVG element.
10612
+ */
10599
10613
  Canvas.prototype.focus = function() {
10600
10614
  this._svg.focus({ preventScroll: true });
10615
+
10616
+ this._setFocused(true);
10601
10617
  };
10602
10618
 
10603
10619
  /**