public static normalizeKeyboardEvent()

in src/service/ui/UIEventNormalizer.ts [230:257]


  public static normalizeKeyboardEvent(
    event: KeyboardEvent,
    contextOffset: Position,
    type: KeyboardEventType
  ): NormalizedKeyboardEvent | void {
    const { key, code, shiftKey, metaKey, ctrlKey, target } = event;
    const originalEvent = event;
    const modKey = IS_MAC ? metaKey : ctrlKey;

    if (UITargetNormalizer.checkAttributeValue(target as Element, 'data-type', DiagramMakerComponentsType.VIEW)) {
      if (key === KeyboardCode.BACKSPACE || (key === 'a' && modKey)) {
        // Prevent the browser from navigating back
        // Since the back is fired on diagram maker
        event.preventDefault();
      }

      return {
        code,
        key,
        ctrlKey,
        shiftKey,
        metaKey,
        modKey,
        originalEvent,
        type
      } as NormalizedKeyboardEvent;
    }
  }