Sha256: 965469d3aa37398d9db32294cd715f203cd89484afebf87a3ecf9883e0b530c5

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

(function($, ns) {
  var AutocompleterTabs = function(target){

    this.root = target;
    this.addRoleAttributes();

    $('.js-tab-button', this.root).on('click focus', function(e){
      $(this).tab('show');
      e.preventDefault();
      e.stopPropagation();
    });
  };

  AutocompleterTabs.prototype.setFirstActive = function(){
    $('.js-tab-button:first', this.root).tab('show');
  };

  AutocompleterTabs.prototype.addRoleAttributes = function(){
    var root = this.root;
    $('.uc-autocompleter-tabs', root).attr('role', 'tablist');
    $('.uc-autocompleter-tabs .uc-autocompleter-tabs__tab', root).attr('role', 'tab');
    $('.uc-autocompleter-tab-panel', root).attr('role', 'tabpanel');
  };

  ns.AutocompleterTabs = AutocompleterTabs;
})(jQuery, window.undercase);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
undercase-0.2.57 app/assets/javascripts/undercase/patterns/tabs.js
undercase-0.2.29 app/assets/javascripts/undercase/patterns/tabs.js