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
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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";
        }
+7 −1
Original line number Diff line number Diff line
@@ -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)