diff --git a/core/lib/Drupal/Core/Render/Element/RenderElement.php b/core/lib/Drupal/Core/Render/Element/RenderElement.php index 249f732ac245e620aaf2147b419dc3e6be50a0f5..bc7621557f9dc154476d6bf4f5e0a960e2958e9c 100644 --- a/core/lib/Drupal/Core/Render/Element/RenderElement.php +++ b/core/lib/Drupal/Core/Render/Element/RenderElement.php @@ -338,7 +338,7 @@ public static function preRenderAjaxForm($element) { // event. This behavior can be explicitly overridden if needed. if (!isset($element['#ajax']['refocus-blur'])) { // The change event on text input types is triggered on blur. - $text_types = ['password', 'textfield', 'number', 'tel', 'textarea']; + $text_types = ['password', 'textfield', 'number', 'tel', 'textarea', 'machine_name']; if ($element['#ajax']['event'] === 'blur' || ($element['#ajax']['event'] === 'change' && in_array($element['#type'], $text_types))) { $element['#attributes']['data-refocus-blur'] = "true"; } diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js index b4e06d595c15843b157c0918cf28ff9390115374..28f1b39ddf49863e760dd7443391cbf2d92b15fe 100644 --- a/core/misc/machine-name.js +++ b/core/misc/machine-name.js @@ -205,7 +205,13 @@ // If it is editable, append an edit link. const $link = $( '<span class="admin-link"><button type="button" class="link" aria-label="' - .concat(Drupal.t('Edit machine name'), '">') + .concat( + Drupal.t('Edit machine name'), + '" data-drupal-selector="'.concat( + $target.data('drupal-selector'), + ), + '-machine-name-admin-link">', + ) .concat(Drupal.t('Edit'), '</button></span>'), ) .on('click', eventData, clickEditHandler)