Skip to content
Snippets Groups Projects
Verified Commit 874adf17 authored by Dave Long's avatar Dave Long
Browse files

Issue #3397742 by lauriii, smustgrave: Improve machine name AJAX focus handling integration

parent ef880948
No related branches found
No related tags found
No related merge requests found
......@@ -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";
}
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment