Skip to content

Commit 844f374

Browse files
authored
WCAG A/AA: Space detail page (#8215)
1 parent b97373b commit 844f374

14 files changed

Lines changed: 106 additions & 24 deletions

File tree

protected/humhub/modules/content/widgets/views/containerProfileHeader.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use humhub\modules\content\assets\ContainerHeaderAsset;
2727
use humhub\modules\content\components\ContentContainerActiveRecord;
2828
use humhub\modules\file\widgets\Upload;
29+
use humhub\modules\space\models\Space;
2930
use humhub\widgets\bootstrap\Link;
3031

3132
ContainerHeaderAsset::register($this);
@@ -68,7 +69,9 @@
6869
'cropUrl' => $coverCropUrl,
6970
'deleteUrl' => $coverDeleteUrl,
7071
'dropZone' => '.profile-banner-image-container',
71-
'confirmBody' => Yii::t('SpaceModule.base', 'Do you really want to delete your title image?'),
72+
'confirmBody' => $container instanceof Space
73+
? Yii::t('SpaceModule.base', 'Do you really want to delete the space title image?')
74+
: Yii::t('SpaceModule.base', 'Do you really want to delete your title image?'),
7275
]) ?>
7376
<?php endif; ?>
7477
</div>
@@ -77,8 +80,16 @@
7780
style="width: <?= $profileImageWidth ?>px; height: <?= $profileImageHeight ?>px;">
7881

7982
<?php if ($container->image->exists()) : ?>
80-
<a data-ui-gallery="spaceHeader" href="<?= $container->image->getUrl([]) ?>">
81-
<?= $container->getProfileImage()->render($profileImageWidth - 10, ['class' => 'img-profile-header-background profile-user-photo', 'link' => false, 'showSelfOnlineStatus' => true]) ?>
83+
<a data-ui-gallery="spaceHeader"
84+
href="<?= $container->image->getUrl([]) ?>"
85+
aria-label="<?= Html::encode($container instanceof Space
86+
? Yii::t('SpaceModule.base', 'View space image of {name}', ['name' => $container->displayName])
87+
: Yii::t('UserModule.base', 'View profile image of {name}', ['name' => $container->displayName])) ?>">
88+
<?= $container->getProfileImage()->render($profileImageWidth - 10, [
89+
'class' => 'img-profile-header-background profile-user-photo',
90+
'link' => false,
91+
'showSelfOnlineStatus' => true,
92+
]) ?>
8293
</a>
8394
<?php else : ?>
8495
<?= $container->getProfileImage()->render($profileImageHeight - 10, ['class' => 'img-profile-header-background profile-user-photo']) ?>
@@ -95,7 +106,9 @@
95106
'deleteUrl' => $imageDeleteUrl,
96107
'cropUrl' => $imageCropUrl,
97108
'dropZone' => '.profile-user-photo-container',
98-
'confirmBody' => Yii::t('SpaceModule.base', 'Do you really want to delete your profile image?'),
109+
'confirmBody' => $container instanceof Space
110+
? Yii::t('SpaceModule.base', 'Do you really want to delete the space image?')
111+
: Yii::t('SpaceModule.base', 'Do you really want to delete your profile image?'),
99112
]) ?>
100113
<?php endif; ?>
101114

protected/humhub/modules/dashboard/views/dashboard/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
]);
2323
?>
2424
</div>
25-
<div class="col-lg-4 layout-sidebar-container">
25+
<aside class="col-lg-4 layout-sidebar-container" aria-label="<?= Html::encode(Yii::t('base', 'Sidebar')) ?>">
2626
<?= Sidebar::widget([
2727
'widgets' => [
2828
[
@@ -33,6 +33,6 @@
3333
]);
3434
?>
3535
<?= FooterMenu::widget(['location' => FooterMenu::LOCATION_SIDEBAR]); ?>
36-
</div>
36+
</aside>
3737
</div>
3838
<?= Html::endContainer() ?>

protected/humhub/modules/dashboard/views/dashboard/index_guest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div class="col-lg-8 layout-content-container">
1414
<?= DashboardContent::widget(); ?>
1515
</div>
16-
<div class="col-lg-4 layout-sidebar-container">
16+
<aside class="col-lg-4 layout-sidebar-container" aria-label="<?= Html::encode(Yii::t('base', 'Sidebar')) ?>">
1717
<?= Sidebar::widget([
1818
'widgets' => [
1919
[
@@ -25,6 +25,6 @@
2525
]);
2626
?>
2727
<?= FooterMenu::widget(['location' => FooterMenu::LOCATION_SIDEBAR]); ?>
28-
</div>
28+
</aside>
2929
</div>
3030
<?= Html::endContainer(); ?>

protected/humhub/modules/notification/views/overview/index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @license https://www.humhub.com/licences
66
*/
77

8+
use humhub\helpers\Html;
89
use humhub\modules\notification\models\forms\FilterForm;
910
use humhub\widgets\bootstrap\Button;
1011
use humhub\modules\notification\widgets\NotificationFilterForm;
@@ -38,7 +39,7 @@
3839
</div>
3940
</div>
4041
</div>
41-
<div class="col-lg-3 layout-sidebar-container">
42+
<aside class="col-lg-3 layout-sidebar-container" aria-label="<?= Html::encode(Yii::t('base', 'Sidebar')) ?>">
4243
<div class="panel panel-default">
4344
<div class="panel-heading">
4445
<strong><?= Yii::t('NotificationModule.base', 'Filter') ?></strong>
@@ -48,6 +49,6 @@
4849
<?= NotificationFilterForm::widget(['filterForm' => $filterForm]) ?>
4950
</div>
5051
</div>
51-
</div>
52+
</aside>
5253
</div>
5354
</div>

protected/humhub/modules/space/views/space/_layout.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use humhub\components\View;
4+
use humhub\helpers\Html;
45
use humhub\modules\content\components\ContentContainerController;
56
use humhub\modules\space\models\Space;
67
use humhub\modules\space\widgets\Header;
@@ -26,17 +27,17 @@
2627
</div>
2728
</div>
2829
<div class="row space-content">
29-
<div class="col-lg-2 layout-nav-container">
30+
<aside class="col-lg-2 layout-nav-container" aria-label="<?= Html::encode(Yii::t('base', 'Sidebar')) ?>">
3031
<?= Menu::widget(['space' => $space]); ?>
31-
</div>
32+
</aside>
3233
<div class="col-lg-<?= ($this->hasSidebar()) ? '7' : '10' ?> layout-content-container">
3334
<?= SpaceContent::widget(['contentContainer' => $space, 'content' => $content]) ?>
3435
</div>
3536
<?php if ($this->hasSidebar()): ?>
36-
<div class="col-lg-3 layout-sidebar-container">
37+
<aside class="col-lg-3 layout-sidebar-container" aria-label="<?= Html::encode(Yii::t('base', 'Sidebar')) ?>">
3738
<?= $this->getSidebar() ?>
3839
<?= FooterMenu::widget(['location' => FooterMenu::LOCATION_SIDEBAR]); ?>
39-
</div>
40+
</aside>
4041
<?php endif; ?>
4142
</div>
4243

protected/humhub/modules/space/widgets/FollowButton.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ public function run()
122122
'{spaceName}' => '<strong>' . Html::encode($this->space->getDisplayName()) . '</strong>',
123123
]);
124124

125+
if ($this->space->isFollowedByUser()) {
126+
$this->unfollowOptions['aria-pressed'] = 'true';
127+
$this->followOptions['aria-pressed'] = 'false';
128+
}
129+
125130
$module = Yii::$app->getModule('space');
126131

127132
// still enable unfollow if following was disabled afterwards.

protected/humhub/modules/space/widgets/HeaderControlsMenu.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,18 @@ public function init()
147147
}
148148
}
149149
}
150+
151+
/**
152+
* @inheritdoc
153+
*/
154+
protected function getOptions()
155+
{
156+
$options = parent::getOptions();
157+
158+
if (!$this->label) {
159+
$options['aria-label'] = Yii::t('SpaceModule.base', 'Space actions');
160+
}
161+
162+
return $options;
163+
}
150164
}

protected/humhub/modules/space/widgets/views/members.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
<?= PanelMenu::widget([
2020
'extraMenus' => Html::tag('li', Link::to(Yii::t('SpaceModule.base', 'Show as List'))->icon('list')->options($showListOptions)),
2121
]) ?>
22-
<div class="panel-heading"<?= Html::renderTagAttributes($showListOptions + ['style' => 'cursor:pointer']) ?>>
23-
<?= Yii::t('SpaceModule.base', '<strong>Space</strong> members'); ?> (<?= $totalMemberCount ?>)
22+
<div class="panel-heading">
23+
<h3 class="panel-title">
24+
<button class="btn-panel-title-action" <?= Html::renderTagAttributes($showListOptions) ?>>
25+
<?= Yii::t('SpaceModule.base', '<strong>Space</strong> members') ?> (<?= $totalMemberCount ?>)
26+
</button>
27+
</h3>
2428
</div>
2529
<div class="panel-body">
2630
<div class="d-flex gap-2 flex-wrap">

protected/humhub/modules/ui/menu/widgets/LeftNavigation.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,13 @@ public function getAttributes()
3636
];
3737
}
3838

39-
39+
/**
40+
* @inheritdoc
41+
*/
42+
protected function getOptions()
43+
{
44+
return array_merge(parent::getOptions(), [
45+
'aria-label' => strip_tags($this->panelTitle),
46+
]);
47+
}
4048
}

protected/humhub/modules/ui/menu/widgets/views/left-navigation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
/* @var $options [] */
1212
?>
1313

14-
<?= Html::beginTag('div', $options) ?>
14+
<?= Html::beginTag('nav', $options) ?>
1515
<?php if (!empty($menu->panelTitle)) : ?>
16-
<div class="panel-heading"><?= $menu->panelTitle; ?></div>
16+
<h2 class="panel-heading"><?= $menu->panelTitle ?></h2>
1717
<?php endif; ?>
1818

1919
<div class="list-group list-group-horizontal list-group-vertical-lg">
2020
<?php foreach ($entries as $entry): ?>
2121
<?= $entry->render(['class' => 'list-group-item']) ?>
2222
<?php endforeach; ?>
2323
</div>
24-
<?= Html::endTag('div') ?>
24+
<?= Html::endTag('nav') ?>

0 commit comments

Comments
 (0)