Sha256: 8f6ad75b13e2c16f83041836487a6b8ce99e49eea4d29af33a33ced8b2c165d7

Contents?: true

Size: 652 Bytes

Versions: 69

Compression:

Stored size: 652 Bytes

Contents

// = require_self

/**
 * When switching tabs in i18n fields, autofocus on the input to save clicks #212
 */
$(() => {
  // Event launched by foundation
  $('[data-tabs]').on('change.zf.tabs', (event) => {
    const $container = $(event.target).next('.tabs-content .tabs-panel.is-active');
    // Detect quilljs editor inside the tabs-panel
    let $content = $container.find('.editor .ql-editor');
    if ($content.length > 0) {
      $content.focus();
    // Detect if inside the tabs-panel have an input
    } else {
      $content = $container.find('input:first');
      if ($content.length > 0) {
        $content.focus();
      }
    }
  });
});

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
decidim-admin-0.0.7 app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-0.0.7 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-admin-0.0.6 app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-0.0.6 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-admin-0.0.5 app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-0.0.5 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-0.0.4 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-admin-0.0.3 app/assets/javascripts/decidim/admin/tab_focus.js.es6
decidim-0.0.3 decidim-admin/app/assets/javascripts/decidim/admin/tab_focus.js.es6