Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More quick a11y updates #11563

Merged
merged 12 commits into from
Jul 20, 2022
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Changed
- Redesigned user notifications. ([#11612](https://github.com/craftcms/cms/pull/11612))
- Most element notifications now include a link to the element. ([#11612](https://github.com/craftcms/cms/pull/11612))
- Improved overall control panel accessibility. ([#11563](https://github.com/craftcms/cms/pull/11563))
- Improved condition builder accessibility. ([#11588](https://github.com/craftcms/cms/pull/11588))
- The “Keep me signed in” checkbox label on the control panel’s login page now includes the remembered session duration, e.g. “Keep me signed in for 2 weeks”. ([#11594](https://github.com/craftcms/cms/discussions/11594))
- Dashboard widgets no longer show a confirmation dialog when deleted. Their delete notifications include an “Undo” button instead. ([#11573](https://github.com/craftcms/cms/discussions/11573))
Expand Down
5 changes: 4 additions & 1 deletion src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -4527,7 +4527,10 @@ public function getMetadata(): array
return false;
}
if ($this->getIsUnpublishedDraft()) {
$icon = Html::tag('span', '', ['data' => ['icon' => 'draft']]);
$icon = Html::tag('span', '', [
'data' => ['icon' => 'draft'],
'aria' => ['hidden' => 'true'],
]);
$label = Craft::t('app', 'Draft');
} else {
$status = $this->getStatus();
Expand Down
3 changes: 3 additions & 0 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,9 @@ public function getAdditionalButtons(): string
'data' => [
'icon' => 'download',
],
'aria' => [
'label' => Craft::t('app', 'Download'),
],
]);

$js = <<<JS
Expand Down
9 changes: 9 additions & 0 deletions src/templates/_includes/revisionmenu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
{% set showMenu = editableSiteIds|length > 1 or showRevisions %}

<div class="context-btngroup btngroup">
{% tag 'label' with {
class: 'visually-hidden',
id: 'context-label',
} %}
{{ 'Context'|t('app') }}
{% endtag %}
{% tag 'button' with {
type: 'button',
class: [
Expand All @@ -74,6 +80,9 @@
data: {
icon: showSiteLabel ? 'world' : null,
},
aria: {
'labelledby': 'context-label',
}
} %}
{%- if showSiteLabel %}
{{- originalElement.getSite().name|t('site') }}
Expand Down
3 changes: 2 additions & 1 deletion src/templates/settings/categories/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
]) %}

{% block actionButton %}
<a href="{{ url('settings/categories/new') }}" class="btn submit add icon">{{ "New category group"|t('app') }}</a>
{% set buttonLabel = "New category group"|t('app') %}
<a href="{{ url('settings/categories/new') }}" class="btn submit add icon" aria-label="{{ buttonLabel }}">{{ buttonLabel }}</a>
{% endblock %}

{% set crumbs = [
Expand Down
1 change: 1 addition & 0 deletions src/translations/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
'Connecting to CraftCMS.com…' => 'Connecting to CraftCMS.com…',
'Content' => 'Content',
'Contents of {path}' => 'Contents of {path}',
'Context' => 'Context',
'Continue anyway' => 'Continue anyway',
'Continue shopping' => 'Continue shopping',
'Continue' => 'Continue',
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css.map

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/web/assets/cp/src/css/_cp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,6 @@ li.breadcrumb-toggle-wrapper {
#global-header,
#header {
.flex {
flex-wrap: nowrap;
max-width: 100%;

&.flex-nowrap {
Expand Down Expand Up @@ -959,10 +958,6 @@ li.breadcrumb-toggle-wrapper {
}
}

#action-buttons {
height: 34px;
}

#main-content {
display: flex;
flex-direction: row;
Expand Down
3 changes: 2 additions & 1 deletion src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,7 @@ ul.icons {
.text {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
min-width: 0;
}
.btn {
border-top-left-radius: 0;
Expand Down Expand Up @@ -6157,7 +6158,7 @@ body .selectize-dropdown {
height: 34px;

&:not(.fullwidth) {
width: 25em;
max-width: 25em;
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/web/assets/cp/src/js/AssetIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ Craft.AssetIndex = Craft.BaseElementIndex.extend({
}
);
} else {
this.$includeSubfoldersContainer.velocity('stop');
this.$includeSubfoldersContainer.velocity('stop').removeClass('hidden');
}

var checked = this.getSelectedSourceState('includeSubfolders', false);
Expand Down Expand Up @@ -899,7 +899,12 @@ Craft.AssetIndex = Craft.BaseElementIndex.extend({
marginBottom: -25,
opacity: 0,
},
'fast'
{
duration: 'fast',
complete: () => {
this.$includeSubfoldersContainer.addClass('hidden');
},
}
);

this.showingIncludeSubfoldersCheckbox = false;
Expand Down
5 changes: 3 additions & 2 deletions src/web/assets/cp/src/js/BaseElementSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Craft.BaseElementSelectorModal = Garnish.Modal.extend(
label: Craft.t('app', 'Select'),
spinner: true,
})
.attr('aria-disabled', 'true')
.appendTo(this.$primaryButtons);

this.$body = $body;
Expand Down Expand Up @@ -253,11 +254,11 @@ Craft.BaseElementSelectorModal = Garnish.Modal.extend(
},

enableSelectBtn: function () {
this.$selectBtn.removeClass('disabled');
this.$selectBtn.removeClass('disabled').attr('aria-disabled', 'false');
},

disableSelectBtn: function () {
this.$selectBtn.addClass('disabled');
this.$selectBtn.addClass('disabled').attr('aria-disabled', 'true');
},

enableCancelBtn: function () {
Expand Down