title: Set the focus and position on an element whitin a Caph-list 3.1 generates navigation not working well
body: <p>everyone.</p>
  
  <p>I am having a little issue setting the focus to an element whitin a horizontal caph-list, and move the view to that element if the element is ahead in the list.
  What I am doing is get the position index of the element whitin the array of elements that will be passed to the caph-list.</p>
  
  <pre><code>index = $.map(favorites, function(obj, index) {
     if (obj.id == element_id) {
     return index;
  }
  </code></pre>
  
  <p>Then, when I create the caph-list I use the <code>initialItemIndex</code> parameter to ensure the element will be displayed on screen no matter its position in the list. I use this because if I do not do this the element I want to set the focus on will not be displayed on screen until I navigate to it.</p>
  
  <pre><code>$('#favorite-items').caphList({
    items: favorites,
    template: 'template-favorite-items',
    duration: '0.7s',
    pageBufferSize: 1,
    initialItemIndex: index,
    containerClass: 'caph-list-container-favorites'
  });
  </code></pre>
  
  <p>After the caph-list object was created, then I use the <code>focus()</code> function to set the focus on that elemenet.</p>
  
  <pre><code>item = $('#' + element_id);
  $.caph.focus.controllerProvider.getInstance().focus(item);
  </code></pre>
  
  <p>With this process I have the focus on the element I want and the element is displayed on the screen, but then the problem starts. When I try to navigate the focusables elemments on screen and press Up or Down Key on the remote control it does not work until I reach the most to right or left element on screen and the caph-list elemets make a reposition and move either to the right or to the left. After the list does a reposition of elements the navigation return to its normal behaivior, up down left right keys work as usual.</p>
  
  <p>This problem with the navigation occurs when I use vertical caph-list too, but in this case I only can navigate elements with Up and Down until the reposition of the elements and only then I have full navigation control again.</p>
  
  <p>Do I need to do something more besides what I have done?</p>
  
  <p>Is there other way to set the focus on an element even if it is ahead in the list?</p>
  
  <p>Is there a way to move to the position to the element I want to focus without affecting the navigation?</p>