Commit c83565f6 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2409885 by nlisgo, tstoeckler, crasx, dmsmidt: Switch shortcut set form...

Issue #2409885 by nlisgo, tstoeckler, crasx, dmsmidt: Switch shortcut set form has accessibility issues
parent 1c3f898e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -100,6 +100,9 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter
          'visible' => array(
            ':input[name="set"]' => array('value' => 'new'),
          ),
          'required' => array(
            ':input[name="set"]' => array('value' => 'new'),
          ),
        ),
      );
      $form['id'] = array(
@@ -162,7 +165,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
    if ($form_state->getValue('set') == 'new') {
      // Check to prevent creating a shortcut set with an empty title.
      if (trim($form_state->getValue('label')) == '') {
        $form_state->setErrorByName('new', $this->t('The new set label is required.'));
        $form_state->setErrorByName('label', $this->t('The new set label is required.'));
      }
    }
  }
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ function testShortcutSetSwitchNoSetName() {
    $this->assertText(t('The new set label is required.'));
    $current_set = shortcut_current_displayed_set($this->adminUser);
    $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
    $this->assertFieldByXPath("//input[@name='label' and contains(concat(' ', normalize-space(@class), ' '), ' error ')]", NULL, 'The new set label field has the error class');
  }

  /**