Thomas Bruederli
2014-06-16 23c00eee86f1a1af9fa74bc9daf30c8d33ba33f0
program/js/treelist.js
@@ -739,7 +739,7 @@
        if (li.length) {
          focus_next(li, (mod = keyCode == 38 || keyCode == 63232 ? -1 : 1));
        }
        break;
        return rcube_event.cancel(e);
      case 37: // Left arrow key
      case 39: // Right arrow key
@@ -747,10 +747,16 @@
        if (li.length) {
          id = dom2id(li);
          node = indexbyid[id];
          if (node && node.children.length)
          if (node && node.children.length && node.collapsed != (keyCode == 37))
            toggle(id, rcube_event.get_modifier(e) == SHIFT_KEY);  // toggle subtree
        }
        return false;
      case 9:  // Tab
        // jump to last/first item to move focus away from the treelist widget by tab
        var limit = rcube_event.get_modifier(e) == SHIFT_KEY ? 'first' : 'last';
        focus_noscroll(container.find('li[role=treeitem]:has(a)')[limit]().find('a:'+limit));
        break;
    }
    return true;
@@ -780,7 +786,19 @@
          focus_next(parent, dir, true);
        }
    }
>>>>>>> dev-accessibility
  }
  /**
   * Focus the given element without scrolling the list container
   */
  function focus_noscroll(elem)
  {
    if (elem.length) {
      var frame = container.parent().get(0) || { scrollTop:0 },
        y = frame.scrollTop || frame.scrollY;
      elem.focus();
      frame.scrollTop = y;
    }
  }