// projde vsechny potomky containeru a nastavi jim dany tabindex
// dobre pro accessibilitu modalu atd.
export function setTabIndexToChildren(container: HTMLElement, tabindex: number) {
   const selectors = [
      'a[href]',
      'a[role="button"]',
      'area[href]',
      'input:not([disabled]):not([type="hidden"])',
      'select:not([disabled])',
      'textarea:not([disabled])',
      'button:not([disabled])',
      'iframe',
      'object',
      'embed',
      '[contenteditable]',
      '[tabindex]:not([tabindex="-1"])',
   ];

   if (container) {
      container.querySelectorAll(selectors.join(',')).forEach((element) => {
         element.setAttribute('tabindex', `${tabindex}`);
      });
   }
}
