diff --git a/core/misc/ajax.es6.js b/core/misc/ajax.es6.js index c3633b4636..d3de666e60 100644 --- a/core/misc/ajax.es6.js +++ b/core/misc/ajax.es6.js @@ -888,7 +888,7 @@ if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { let target = false; - for (let n = elementParents.length - 1; !target && n > 0; n--) { + for (let n = elementParents.length - 1; !target && n >= 0; n--) { target = document.querySelector(`[data-drupal-selector="${elementParents[n].getAttribute('data-drupal-selector')}"]`); } diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 58759ac7a0..74b42051aa 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -420,7 +420,7 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr if (!focusChanged && this.element && !$(this.element).data('disable-refocus')) { var target = false; - for (var n = elementParents.length - 1; !target && n > 0; n--) { + for (var n = elementParents.length - 1; !target && n >= 0; n--) { target = document.querySelector('[data-drupal-selector="' + elementParents[n].getAttribute('data-drupal-selector') + '"]'); } diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php index 628408e997..b6f1077785 100644 --- a/core/modules/views_ui/src/ViewListBuilder.php +++ b/core/modules/views_ui/src/ViewListBuilder.php @@ -178,6 +178,14 @@ public function getDefaultOperations(EntityInterface $entity) { } } + // ajax.js focuses automatically the data-drupal-selector element. When + // enabling the view again, focusing on the disable link doesn't work, as it + // is hidden. We assign data-drupal-selector to every link, so it focuses + // on the edit link. + foreach ($operations as &$operation) { + $operation['attributes']['data-drupal-selector'][] = 'views-listing-' . $entity->id(); + } + return $operations; }