MDL-67275 forum: Fix language and accessibility issues with buttons

There were inconsistencies with the text shown on the submit button,
depending on the where the button was shown.

* Inline reply forum displayed general "Submit".
* Experimental nested discussion view reply form displayed "Post"
  (post/core string) which acts as a noun in other contexts and cannot
  be used as such in many non-English languages.
* Advanced reply form displayed "Post to forum".

The patch fixes this and starts to show "Post to forum" in all three
places consistently.

While working on this, two more issues were noticed and fixed:

* Inline reply textarea's title was hard-coded English "post" text.
  Changed to "Message" to provide advisory information related to the
  element.
* Buttons contained title attribute with the same value as the explicit
  button text. This goes against accessibility guidelines.
This commit is contained in:
David Mudrák
2020-09-21 22:48:33 +02:00
parent d4d798e684
commit 0188cc2ed7
3 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -38,7 +38,7 @@
<form data-post-id="{{postid}}" id="inpage-reply-{{postid}}" data-content="inpage-reply-form" action="{{{reply_url}}}">
<div class="row pb-1">
<span>
<textarea rows="5" name="post" title="post" class="form-control" placeholder="{{#str}} replyplaceholder, forum {{/str}}"></textarea>
<textarea rows="5" name="post" title="{{#str}} message, mod_forum {{/str}}" class="form-control" placeholder="{{#str}} replyplaceholder, forum {{/str}}"></textarea>
<input type="hidden" name="postformat" value="{{postformat}}"/>
</span>
<input type="hidden" name="subject" value="{{parentsubject}}"/>
@@ -46,11 +46,11 @@
<input type="hidden" name="sesskey" value="{{sesskey}}"/>
</div>
<div class="row">
<button class="btn btn-primary" title="{{#str}} submit, core {{/str}}" data-action="forum-inpage-submit">
<span data-region="submit-text">{{#str}} submit, core {{/str}}</span>
<button class="btn btn-primary" data-action="forum-inpage-submit">
<span data-region="submit-text">{{#str}} posttoforum, mod_forum {{/str}}</span>
<span data-region="loading-icon-container" class="hidden">{{> core/loading }}</span>
</button>
<button class="btn btn-secondary" title="{{#str}} cancel, core {{/str}}" data-action="collapsible-link">
<button class="btn btn-secondary" data-action="collapsible-link">
{{#str}} cancel, core {{/str}}
</button>
{{#canreplyprivately}}
@@ -59,7 +59,7 @@
<label class="form-check-label" for="private-reply-checkbox-{{uniqid}}">{{#str}} privatereply, forum {{/str}}</label>
</div>
{{/canreplyprivately}}
<button title="{{#str}} advanced, core {{/str}}" data-action="forum-advanced-reply" class="btn btn-link float-right" type="submit">
<button data-action="forum-advanced-reply" class="btn btn-link float-right" type="submit">
{{#str}} advanced, core {{/str}}
</button>
</div>
+1 -1
View File
@@ -74,7 +74,7 @@
<input type="hidden" name="sesskey" value="{{sesskey}}"/>
<div class="d-flex mt-3 align-items-center flex-wrap">
<button class="btn btn-primary font-weight-bold px-3" data-action="forum-inpage-submit">
<span data-region="submit-text">{{#str}} post, core {{/str}}</span>
<span data-region="submit-text">{{#str}} posttoforum, mod_forum {{/str}}</span>
<span data-region="loading-icon-container" class="hidden">{{> core/loading }}</span>
</button>
<button data-action="forum-advanced-reply" class="btn btn-link mr-auto" type="submit">
+1 -1
View File
@@ -121,7 +121,7 @@ class behat_mod_forum extends behat_base {
// Fill form and post.
$this->execute('behat_forms::i_set_the_following_fields_to_these_values', $table);
$this->execute('behat_forms::press_button', get_string('submit', 'core'));
$this->execute('behat_forms::press_button', get_string('posttoforum', 'mod_forum'));
}
/**