diff --git a/public/mod/forum/renderer.php b/public/mod/forum/renderer.php index 1a43cc90a9d..7903f118e93 100644 --- a/public/mod/forum/renderer.php +++ b/public/mod/forum/renderer.php @@ -87,24 +87,51 @@ class mod_forum_renderer extends plugin_renderer_base { $output .= html_writer::start_tag('form', $formattributes); $output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey())); - $existingcell = new html_table_cell(); - $existingcell->text = $existinguc->display(true); - $existingcell->attributes['class'] = 'existing'; - $actioncell = new html_table_cell(); - $actioncell->text = html_writer::start_tag('div', array()); - $actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'subscribe', 'value'=>$this->page->theme->larrow.' '.get_string('add'), 'class'=>'actionbutton')); - $actioncell->text .= html_writer::empty_tag('br', array()); - $actioncell->text .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'unsubscribe', 'value'=>$this->page->theme->rarrow.' '.get_string('remove'), 'class'=>'actionbutton')); - $actioncell->text .= html_writer::end_tag('div', array()); - $actioncell->attributes['class'] = 'actions'; - $potentialcell = new html_table_cell(); - $potentialcell->text = $potentialuc->display(true); - $potentialcell->attributes['class'] = 'potential'; + // Existing subscribers column. + $existingsubslabel = html_writer::label( + get_string('existingsubscribers', 'forum'), + 'existingsubscribers', + false, + ['class' => 'visually-hidden'] + ); + $existingsubscol = html_writer::div($existingsubslabel . $existinguc->display(true), 'col-sm-5 px-0 existing'); - $table = new html_table(); - $table->attributes['class'] = 'subscribertable boxaligncenter table-reboot'; - $table->data = array(new html_table_row(array($existingcell, $actioncell, $potentialcell))); - $output .= html_writer::table($table); + // Actions column. + $subscribeaction = html_writer::tag( + 'button', + html_writer::span($this->page->theme->larrow, '', ['aria-hidden' => 'true']) . ' ' . get_string('add'), + [ + 'type' => 'submit', + 'name' => 'subscribe', + 'class' => 'actionbutton btn btn-secondary w-100 my-1 py-2', + 'value' => 'subscribe', + ] + ); + $subscribeaction = html_writer::div($subscribeaction); + $unsubscribeaction = html_writer::tag( + 'button', + get_string('remove') . ' ' . html_writer::span($this->page->theme->rarrow, '', ['aria-hidden' => 'true']), + [ + 'type' => 'submit', + 'name' => 'unsubscribe', + 'class' => 'actionbutton btn btn-secondary w-100 my-1 py-2', + 'value' => 'unsubscribe', + ] + ); + $unsubscribeaction = html_writer::div($unsubscribeaction); + $actionscol = html_writer::div($subscribeaction . $unsubscribeaction, 'col-sm-2 actions py-6'); + + // Potential subscribers column. + $potentialsubslabel = html_writer::label( + get_string('potentialsubscribers', 'forum'), + 'potentialsubscribers', + false, + ['class' => 'visually-hidden'] + ); + $potentialsubscol = html_writer::div($potentialsubslabel . $potentialuc->display(true), 'col-sm-5 px-0 potential'); + + $row = html_writer::div($existingsubscol . $actionscol . $potentialsubscol, 'row'); + $output .= html_writer::div($row, 'container-fluid'); $output .= html_writer::end_tag('form'); return $output; diff --git a/public/mod/forum/styles.css b/public/mod/forum/styles.css index 8ab019225b3..8a7491484fa 100644 --- a/public/mod/forum/styles.css +++ b/public/mod/forum/styles.css @@ -144,32 +144,11 @@ } /** Styles for subscribers.php */ -#page-mod-forum-subscribers .subscriberdiv, -#page-mod-forum-subscribers .subscribertable { +#page-mod-forum-subscribers .subscriberdiv { width: 100%; vertical-align: top; } -#page-mod-forum-subscribers .subscribertable tr td { - vertical-align: top; -} - -#page-mod-forum-subscribers .subscribertable tr td.actions { - width: 16%; - padding-top: 3em; -} - -#page-mod-forum-subscribers .subscribertable tr td.actions .actionbutton { - margin: 0.3em 0; - padding: 0.5em 0; - width: 100%; -} - -#page-mod-forum-subscribers .subscribertable tr td.existing, -#page-mod-forum-subscribers .subscribertable tr td.potential { - width: 42%; -} - /** Styles for discuss.php **/ #page-mod-forum-discuss .discussioncontrols { width: 100%; diff --git a/public/mod/forum/tests/behat/forum_subscribers_navigation.feature b/public/mod/forum/tests/behat/forum_subscribers_navigation.feature index 4ca1dfc7e37..8c979869ec5 100644 --- a/public/mod/forum/tests/behat/forum_subscribers_navigation.feature +++ b/public/mod/forum/tests/behat/forum_subscribers_navigation.feature @@ -36,6 +36,7 @@ Feature: A teacher or admin can view subscriptions tab And I should see "Everyone can now choose to be subscribed" And I should see "View subscribers" + @accessibility Scenario: A teacher selects forced subscription and subscribers selector is not visible Given I am on the "Test forum name" "forum activity" page logged in as teacher And I navigate to "Subscriptions" in current page administration @@ -46,6 +47,7 @@ Feature: A teacher or admin can view subscriptions tab And I should not see "Forced subscription" And I should not see "Auto subscription" And I should not see "Subscription disabled" + And the "region-main" "region" should meet accessibility standards with "best-practice" extra tests Scenario: A teacher selects reports tab and verify the heading Given I am on the "Test forum name" "forum activity" page logged in as teacher