diff --git a/core/modules/system/tests/fixtures/HtaccessTest/access_test.module~ b/core/modules/system/tests/fixtures/HtaccessTest/access_test.module~ old mode 100644 new mode 100755 diff --git a/core/modules/system/tests/fixtures/HtaccessTest/access_test.php~ b/core/modules/system/tests/fixtures/HtaccessTest/access_test.php~ old mode 100644 new mode 100755 diff --git a/core/modules/views_ui/js/views_ui.listing.js b/core/modules/views_ui/js/views_ui.listing.js index 7d19cd4..1daab04 100644 --- a/core/modules/views_ui/js/views_ui.listing.js +++ b/core/modules/views_ui/js/views_ui.listing.js @@ -51,4 +51,37 @@ } }; + + // When a view is enabled/disabled, this variable will hold it's machine name. + // It is used in the behavior to focus on the first dropbutton link of this + // view's row. + var changedView = ''; + + /** + * Handles focus after Ajax update. + * + * @type {Drupal~behavior} + * + * @prop {Drupal~behaviorAttach} attach + * Listen to disable events on views listing page to keep focus in context. + */ + Drupal.behaviors.viewsChangeFocus = { + attach: function (context) { + // Enable a view, keep the machine name around so that the next round of + // Drupal.behaviorAttach() focuses it. + $(context).find('[data-drupal-view-id] .use-ajax').once('viewsUiListFocus') + .on('click', function (event) { + // Store the machine name of the view to focus after ajax update. + changedView = $(event.target).closest('tr').attr('data-drupal-view-id'); + }); + + // A view has been enabled/disabled, focus the first dropbutton link. + if (changedView && changedView !== '') { + $('[data-drupal-view-id="' + changedView + '"]') + .find('.dropbutton a').eq(0).trigger('focus'); + changedView = ''; + } + } + }; + }(jQuery, Drupal)); diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php index 9cb427e..4de1bf3 100644 --- a/core/modules/views_ui/src/ViewListBuilder.php +++ b/core/modules/views_ui/src/ViewListBuilder.php @@ -122,6 +122,7 @@ public function buildRow(EntityInterface $view) { ), 'title' => $this->t('Machine name: @name', array('@name' => $view->id())), 'class' => array($view->status() ? 'views-ui-list-enabled' : 'views-ui-list-disabled'), + 'data-drupal-view-id' => $view->id(), ); }