Add ARIA label to form text editor without label
This commit is contained in:
@@ -237,6 +237,7 @@ class FormHelper extends Base
|
|||||||
'labelWrite' => t('Write'),
|
'labelWrite' => t('Write'),
|
||||||
'labelTitle' => t('Title'),
|
'labelTitle' => t('Title'),
|
||||||
'placeholder' => t('Write your text in Markdown'),
|
'placeholder' => t('Write your text in Markdown'),
|
||||||
|
'ariaLabel' => isset($attributes['aria-label']) ? $attributes['aria-label'] : '',
|
||||||
'autofocus' => isset($attributes['autofocus']) && $attributes['autofocus'],
|
'autofocus' => isset($attributes['autofocus']) && $attributes['autofocus'],
|
||||||
'suggestOptions' => array(
|
'suggestOptions' => array(
|
||||||
'triggers' => array(
|
'triggers' => array(
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class TaskHelper extends Base
|
|||||||
|
|
||||||
public function renderDescriptionField(array $values, array $errors)
|
public function renderDescriptionField(array $values, array $errors)
|
||||||
{
|
{
|
||||||
return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2));
|
return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2, 'aria-label' => t('Description')));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderDescriptionTemplateDropdown($projectId)
|
public function renderDescriptionTemplateDropdown($projectId)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<form method="post" action="<?= $this->url->href('CommentController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
<form method="post" action="<?= $this->url->href('CommentController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
||||||
<?= $this->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
|
|
||||||
<?= $this->form->textEditor('comment', $values, $errors, array('autofocus' => true, 'required' => true)) ?>
|
<?= $this->form->textEditor('comment', $values, $errors, array('autofocus' => true, 'required' => true, 'aria-label' => t('New comment'))) ?>
|
||||||
|
|
||||||
<?= $this->modal->submitButtons() ?>
|
<?= $this->modal->submitButtons() ?>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<form method="post" action="<?= $this->url->href('CommentController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off">
|
<form method="post" action="<?= $this->url->href('CommentController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'comment_id' => $comment['id'])) ?>" autocomplete="off">
|
||||||
<?= $this->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
|
|
||||||
<?= $this->form->textEditor('comment', $values, $errors, array('autofocus' => true, 'required' => true)) ?>
|
<?= $this->form->textEditor('comment', $values, $errors, array('autofocus' => true, 'required' => true, 'aria-label' => t('Comment'))) ?>
|
||||||
|
|
||||||
<?= $this->modal->submitButtons() ?>
|
<?= $this->modal->submitButtons() ?>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<form method="post" action="<?= $this->url->href('CommentListController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
<form method="post" action="<?= $this->url->href('CommentListController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
|
||||||
<?= $this->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->textEditor('comment', array('project_id' => $task['project_id']), array(), array('required' => true)) ?>
|
<?= $this->form->textEditor('comment', array('project_id' => $task['project_id']), array(), array('required' => true, 'aria-label' => t('New comment'))) ?>
|
||||||
<?= $this->modal->submitButtons() ?>
|
<?= $this->modal->submitButtons() ?>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true, 'tabindex' => 3)) ?>
|
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true, 'tabindex' => 3, 'aria-label' => t('New comment'))) ?>
|
||||||
|
|
||||||
<?= $this->modal->submitButtons(array(
|
<?= $this->modal->submitButtons(array(
|
||||||
'submitLabel' => t('Send by email'),
|
'submitLabel' => t('Send by email'),
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
<?= $this->form->hidden('task_id', $values) ?>
|
<?= $this->form->hidden('task_id', $values) ?>
|
||||||
<?= $this->form->hidden('user_id', $values) ?>
|
<?= $this->form->hidden('user_id', $values) ?>
|
||||||
|
|
||||||
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true)) ?>
|
<?= $this->form->textEditor('comment', $values, $errors, array('required' => true, 'aria-label' => t('New comment'))) ?>
|
||||||
<?= $this->modal->submitButtons() ?>
|
<?= $this->modal->submitButtons() ?>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ KB.component('text-editor', function (containerElement, options) {
|
|||||||
textareaElement.attr('required', 'required');
|
textareaElement.attr('required', 'required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.ariaLabel) {
|
||||||
|
textareaElement.attr('aria-label', options.ariaLabel);
|
||||||
|
}
|
||||||
|
|
||||||
// Order is important for IE11 (especially for the placeholder)
|
// Order is important for IE11 (especially for the placeholder)
|
||||||
var textWrapper = KB.dom(containerElement).find('script');
|
var textWrapper = KB.dom(containerElement).find('script');
|
||||||
textareaElement.html(textWrapper.innerHTML);
|
textareaElement.html(textWrapper.innerHTML);
|
||||||
|
|||||||
Reference in New Issue
Block a user