function focusInside(container, fn) {
    var
      toFocus = null,
      focusables = getFocusables(fetchFocusables(container));

    if (typeof fn === 'function') {
      toFocus = fn(container, focusables);
    }
    if (!toFocus && focusables.length) {
      toFocus = focusables[0];
    }
    if (!toFocus) {
      var containerTabindex = container.getAttribute('tabindex');
      if (!containerTabindex) {
        container.setAttribute('tabindex', '-1');
      }
      toFocus = container;
    }

    toFocus.focus();
  }
/**
   *
   * @param container DOM-Element
   * @param fn(container, focusables) Function returning the element to focus
   */
@param container DOM-Element
@param fn(container, focusables) Function returning the element to focus
@param container DOM - Element @param fn ( container focusables ) Function returning the element to focus
function focusInside(container, fn) {
    var
      toFocus = null,
      focusables = getFocusables(fetchFocusables(container));
    if (typeof fn === 'function') {
      toFocus = fn(container, focusables);
    }
    if (!toFocus && focusables.length) {
      toFocus = focusables[0];
    }
    if (!toFocus) {
      var containerTabindex = container.getAttribute('tabindex');
      if (!containerTabindex) {
        container.setAttribute('tabindex', '-1');
      }
      toFocus = container;
    }
    toFocus.focus();
  }
function focusInside ( container , fn ) { var toFocus = null , focusables = getFocusables ( fetchFocusables ( container ) ) ; if ( typeof fn === 'function' ) { toFocus = fn ( container , focusables ) ; } if ( ! toFocus && focusables . length ) { toFocus = focusables [ 0 ] ; } if ( ! toFocus ) { var containerTabindex = container . getAttribute ( 'tabindex' ) ; if ( ! containerTabindex ) { container . setAttribute ( 'tabindex' , '-1' ) ; } toFocus = container ; } toFocus . focus ( ) ; }
@param container DOM-Element
 @param fn(container, focusables) Function returning the element to focus
@param container DOM - Element @param fn ( container focusables ) Function returning the element to focus