All files / common/helpers rtl.ts

83.33% Statements 5/6
42.85% Branches 3/7
100% Functions 2/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15          1x 338x   1x 20x 20x        
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
/** */
export const isRTL = (elem?: HTMLElement): boolean =>
  getComputedStyle(elem ?? document.documentElement).direction === 'rtl';
 
export const correctKeyRTL = (key: string): string => {
  if (!isRTL()) {
    return key;
  }
  return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;
};