vendredi 21 décembre 2018

Force tab to specific element

I am inside of a tab panel. Once a tab is selected I can tab through three columns of list items. At the end of each column is a button. Once the tab reaches the last column, last element in the column the tabpanel is closed and moves to the next element on the page.

My expectation is that once it reaches the last column, last element that it would move to the next Tab and so forth until it reaches the last element in the last tab.

My idea was to add an event listener to the last element, that listens for a ‘keyup or a focus out’ event that will apply focus or a tabindex to the next desired element

const lastElementBtn = $('.panel-column__last-element’);

lastElementlBtn.addEventListener('keyup', event => {
  if (event.code == 'Tab') {
    getFocus();
  }

  function getFocus() {
    $(‘.panel-tab__next’)
      .parent()
      .focus();
  }
});

The next tab is still not receiving focus




Aucun commentaire:

Enregistrer un commentaire