Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / contextual / js / toolbar / views / AuralView.js
index d684ffb9e63e52aa850a4a76521e310ed147c54a..7bf7e4076529534bf69ccaf9c42171d5d7799a7a 100644 (file)
@@ -1,32 +1,15 @@
 /**
- * @file
- * A Backbone View that provides the aural view of the edit mode toggle.
- */
+* DO NOT EDIT THIS FILE.
+* See the following change record for more information,
+* https://www.drupal.org/node/2815083
+* @preserve
+**/
 
 (function ($, Drupal, Backbone, _) {
-
-  'use strict';
-
-  Drupal.contextualToolbar.AuralView = Backbone.View.extend(/** @lends Drupal.contextualToolbar.AuralView# */{
-
-    /**
-     * Tracks whether the tabbing constraint announcement has been read once.
-     *
-     * @type {bool}
-     */
+  Drupal.contextualToolbar.AuralView = Backbone.View.extend({
     announcedOnce: false,
 
-    /**
-     * Renders the aural view of the edit mode toggle (screen reader support).
-     *
-     * @constructs
-     *
-     * @augments Backbone.View
-     *
-     * @param {object} options
-     *   Options for the view.
-     */
-    initialize: function (options) {
+    initialize: function initialize(options) {
       this.options = options;
 
       this.listenTo(this.model, 'change', this.render);
 
       $(document).on('keyup', _.bind(this.onKeypress, this));
     },
-
-    /**
-     * @inheritdoc
-     *
-     * @return {Drupal.contextualToolbar.AuralView}
-     *   The current contextual toolbar aural view.
-     */
-    render: function () {
-      // Render the state.
+    render: function render() {
       this.$el.find('button').attr('aria-pressed', !this.model.get('isViewing'));
 
       return this;
     },
-
-    /**
-     * Limits tabbing to the contextual links and edit mode toolbar tab.
-     */
-    manageTabbing: function () {
+    manageTabbing: function manageTabbing() {
       var tabbingContext = this.model.get('tabbingContext');
-      // Always release an existing tabbing context.
+
       if (tabbingContext) {
+        if (tabbingContext.active) {
+          Drupal.announce(this.options.strings.tabbingReleased);
+        }
         tabbingContext.release();
-        Drupal.announce(this.options.strings.tabbingReleased);
       }
-      // Create a new tabbing context when edit mode is enabled.
+
       if (!this.model.get('isViewing')) {
         tabbingContext = Drupal.tabbingManager.constrain($('.contextual-toolbar-tab, .contextual'));
         this.model.set('tabbingContext', tabbingContext);
         this.announcedOnce = true;
       }
     },
-
-    /**
-     * Announces the current tabbing constraint.
-     */
-    announceTabbingConstraint: function () {
+    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);
     },
-
-    /**
-     * Responds to esc and tab key press events.
-     *
-     * @param {jQuery.Event} event
-     *   The keypress event.
-     */
-    onKeypress: function (event) {
-      // The first tab key press is tracked so that an annoucement about tabbing
-      // constraints can be raised if edit mode is enabled when the page is
-      // loaded.
+    onKeypress: function onKeypress(event) {
       if (!this.announcedOnce && event.keyCode === 9 && !this.model.get('isViewing')) {
         this.announceTabbingConstraint();
-        // Set announce to true so that this conditional block won't run again.
+
         this.announcedOnce = true;
       }
-      // Respond to the ESC key. Exit out of edit mode.
+
       if (event.keyCode === 27) {
         this.model.set('isViewing', true);
       }
     }
-
   });
-
-})(jQuery, Drupal, Backbone, _);
+})(jQuery, Drupal, Backbone, _);
\ No newline at end of file