Skip to content
AuralView.js 1.95 KiB
Newer Older
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
  Drupal.contextualToolbar.AuralView = Backbone.View.extend({
      this.options = options;

      this.listenTo(this.model, 'change', this.render);
      this.listenTo(this.model, 'change:isViewing', this.manageTabbing);

      $(document).on('keyup', _.bind(this.onKeypress, this));
    },
      this.$el.find('button').attr('aria-pressed', !this.model.get('isViewing'));

      return this;
    },
      var tabbingContext = this.model.get('tabbingContext');
        if (tabbingContext.active) {
          Drupal.announce(this.options.strings.tabbingReleased);
        }
      if (!this.model.get('isViewing')) {
        tabbingContext = Drupal.tabbingManager.constrain($('.contextual-toolbar-tab, .contextual'));
        this.model.set('tabbingContext', tabbingContext);
        this.announceTabbingConstraint();
        this.announcedOnce = true;
      }
    },
    announceTabbingConstraint: function announceTabbingConstraint() {
      var strings = this.options.strings;
      Drupal.announce(Drupal.formatString(strings.tabbingConstrained, {
        '@contextualsCount': Drupal.formatPlural(Drupal.contextual.collection.length, '@count contextual link', '@count contextual links')
      }));
      Drupal.announce(strings.pressEsc);
    },
      if (!this.announcedOnce && event.keyCode === 9 && !this.model.get('isViewing')) {
        this.announceTabbingConstraint();
      if (event.keyCode === 27) {
        this.model.set('isViewing', true);
      }
    }
  });