Commit 4bca1071 authored by Dennis Cohn's avatar Dennis Cohn
Browse files

Issue #3218015: Javascript throws error when tabs are not available

parent 206f4d1d
Loading
Loading
Loading
Loading
+13 −8
Changes for assets/src/js/cool_editor_tabs.js: 13 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -2,13 +2,18 @@
 * @file
 * Javascript functionality for the Cool Editor Tabs.
 */
(function ($, Drupal) {
(function () {
  'use strict';
  Drupal.behaviors.coolEditorTabs = {
    attach: function (context) {
      $(context).find('#js-admin-tabs-toggle').once('coolEditorTabsExpand').click(function () {
        $('#admin-tabs__list').attr('aria-expanded', $('#admin-tabs__list').attr('aria-expanded') === 'false' ? 'true' : 'false');
      });

  var tabs = document.getElementById('js-admin-tabs-toggle');

  if (!tabs) {
    return;
  }
  };
})(jQuery, Drupal);

  tabs.onclick = function(e){
    var adminTabs = document.getElementById('admin-tabs__list');
    adminTabs.setAttribute('aria-expanded', adminTabs.getAttribute('aria-expanded') === 'false' ? 'true' : 'false');
  }

}());