Skip to content

Commit

Permalink
Merge pull request #14335 from craftcms/a11y/global-nav-aria-hide
Browse files Browse the repository at this point in the history
Sets aria-hidden on global sidebar when toggled
  • Loading branch information
brandonkelly authored Feb 10, 2024
2 parents 2f16a6d + 61cf1ca commit 13218ac
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
- Improved the accessibility of layout tabs. ([#14215](https://github.com/craftcms/cms/pull/14215))
- Improved the accessibility of overflow tab menus. ([#14214](https://github.com/craftcms/cms/pull/14214))
- Increased the hit area for range select options.
- Improved the accessibility of the global sidebar. ([#14335](https://github.com/craftcms/cms/pull/14335))

### Administration
- Added the “Color” entry type setting. ([#14187](https://github.com/craftcms/cms/pull/14187))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Restored the “Preview” and “Edit Image” buttons on asset image previews. ([#14333](https://github.com/craftcms/cms/discussions/14333))
- Improved the accessibility of the global sidebar. ([#14335](https://github.com/craftcms/cms/pull/14335))
- Fixed a bug where read/write splitting was always getting disabled for GraphQL POST requests. ([#14324](https://github.com/craftcms/cms/issues/14324))

## 5.0.0-beta.1 - 2024-02-08
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/authmethodsetup/dist/css/auth.css.map

Large diffs are not rendered by default.

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.

32 changes: 16 additions & 16 deletions src/web/assets/cp/src/js/CP.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,32 +495,32 @@ Craft.CP = Garnish.Base.extend(
if (isExpanded === null) return;

if (isExpanded) {
this.disableGlobalSidebarLinks();
this.disableGlobalSidebar();
this.$navToggle.focus();
this.$navToggle.attr('aria-expanded', 'false');
Garnish.$bod.removeClass('showing-nav');
} else {
this.enableGlobalSidebarLinks();
this.enableGlobalSidebar();
this.$globalSidebar.find(':focusable')[0].focus();
this.$navToggle.attr('aria-expanded', 'true');
Garnish.$bod.addClass('showing-nav');
}
},

enableGlobalSidebarLinks: function () {
const focusableItems = this.$globalSidebar.find(':focusable');

$(focusableItems).each(function () {
$(this).attr('tabindex', '0');
});
/**
* Makes the global sidebar navigable by screen reader and keyboard users
**/
enableGlobalSidebar: function () {
this.$globalSidebar.attr('aria-hidden', 'false');
this.$globalSidebar.find(':focusable').attr('tabindex', '0');
},

disableGlobalSidebarLinks: function () {
const focusableItems = this.$globalSidebar.find(':focusable');

$(focusableItems).each(function () {
$(this).attr('tabindex', '-1');
});
/**
* Hides the global sidebar from screen reader and keyboard users
**/
disableGlobalSidebar: function () {
this.$globalSidebar.attr('aria-hidden', 'true');
this.$globalSidebar.find(':focusable').attr('tabindex', '-1');
},

setSidebarNavAttributes: function () {
Expand All @@ -529,9 +529,9 @@ Craft.CP = Garnish.Base.extend(
if (isExpanded === null) return;

if (!isExpanded) {
this.disableGlobalSidebarLinks();
this.disableGlobalSidebar();
} else {
this.enableGlobalSidebarLinks();
this.enableGlobalSidebar();
}
},

Expand Down

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

0 comments on commit 13218ac

Please sign in to comment.