diff --git a/core/modules/outside_in/js/offcanvas.js b/core/modules/outside_in/js/offcanvas.js index 88531dd..de6f0c7 100644 --- a/core/modules/outside_in/js/offcanvas.js +++ b/core/modules/outside_in/js/offcanvas.js @@ -79,14 +79,12 @@ * Object holding the server response. * @param {number} [status] * The HTTP status code. - * - * @return {bool} - * Returns false. */ Drupal.AjaxCommands.prototype.openOffCanvas = function (ajax, response, status) { - // Set animation duration and get #page-wrapper width. + // Discover display/viewport size. TODO: work in breakpoints for tray size. var $pageWrapper = $('#canvas-tray-wrapper'); var pageWidth = $pageWrapper.width(); + // Set the initial state of the off canvas element. // If the state has been set previously, use it. Drupal.offCanvas = { @@ -104,19 +102,19 @@ // Put everything together. $offcanvasWrapper.append([$offcanvasClose, $title, $offcanvasContent]); - // Only add off canvas elements if we have none visible. + // Handle opening or updating tray with content. if (!Drupal.offCanvas.visible) { - // Append off canvas wrapper to the 'page' + // Append content then open tray. $pageWrapper.append($offcanvasWrapper); Drupal.offCanvas.visible = true; $pageWrapper.addClass('js-tray-open'); + Drupal.announce(Drupal.t('Configuration tray opened.')); } else { - // If tray already open, remove content add new. + // Remove previous content then append new content. $pageWrapper.find('#offcanvas').remove(); $pageWrapper.append($offcanvasWrapper); + Drupal.announce(Drupal.t('Configuration tray content has been updated.')); } - - return false; }; })(jQuery, Drupal);