Commit c83565f6 authored by alexpott's avatar alexpott
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
...@@ -100,6 +100,9 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter ...@@ -100,6 +100,9 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter
'visible' => array( 'visible' => array(
':input[name="set"]' => array('value' => 'new'), ':input[name="set"]' => array('value' => 'new'),
), ),
'required' => array(
':input[name="set"]' => array('value' => 'new'),
),
), ),
); );
$form['id'] = array( $form['id'] = array(
...@@ -162,7 +165,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { ...@@ -162,7 +165,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
if ($form_state->getValue('set') == 'new') { if ($form_state->getValue('set') == 'new') {
// Check to prevent creating a shortcut set with an empty title. // Check to prevent creating a shortcut set with an empty title.
if (trim($form_state->getValue('label')) == '') { 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.'));
} }
} }
} }
......
...@@ -134,6 +134,7 @@ function testShortcutSetSwitchNoSetName() { ...@@ -134,6 +134,7 @@ function testShortcutSetSwitchNoSetName() {
$this->assertText(t('The new set label is required.')); $this->assertText(t('The new set label is required.'));
$current_set = shortcut_current_displayed_set($this->adminUser); $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->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');
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment