Skip to content

Commit

Permalink
A11y: add skiplinks and correct tabindex order #16612
Browse files Browse the repository at this point in the history
  • Loading branch information
jenswittmann committed Sep 18, 2024
1 parent f903a73 commit aac69f5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
22 changes: 22 additions & 0 deletions _build/templates/default/sass/_a11y.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,25 @@
}
}
}

// skiplinks
.skiplinks {
position: fixed;
top: -100rem;
left: -100rem;
z-index: 99999;
width: 0;
height: 0;

a {
&:focus,
&:active {
position: fixed;
top: 0;
left: 0;
padding: 1rem;
margin: 1rem;
background-color: white;
}
}
}
3 changes: 2 additions & 1 deletion _build/templates/default/sass/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@
}
}

&:hover {
&:hover,
&:focus-within {
.action-buttons {
button {
opacity: 1;
Expand Down
3 changes: 2 additions & 1 deletion _build/templates/default/sass/_tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@
}

&:hover,
&:focus {
&:focus,
&:focus-within {
.modx-tree-node-btn-create {
opacity: 1.0;
}
Expand Down
6 changes: 3 additions & 3 deletions manager/assets/modext/util/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ Ext.override(Ext.tree.TreeNodeUI,{
elbowMarkup,
iconMarkup,
cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
'<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
'<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="0" ',
a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',renderer(a),"</span></a></div>",
'<ul class="x-tree-node-ct" style="display:none;"></ul>',
"</li>"].join('');
Expand Down Expand Up @@ -493,8 +493,8 @@ MODx.util.Format = {
},
/**
* Trim a set of characters from the beginning and/or ending of a string
* @param {String} string
* @param {String} charList
* @param {String} string
* @param {String} charList
*/
trimCharacters: function(string, charList = '', direction = 'both') {
if (charList.length) {
Expand Down
8 changes: 8 additions & 0 deletions manager/templates/default/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
</head>
<body id="modx-body-tag">

<section aria-label="skip links">
<ul class="skiplinks">
<li><a href="#modx-home-dashboard">skip to main navigation</a></li>
<li><a href="#modx-leftbar">skip to sidebar</a></li>
<li><a href="#modx-content">skip to main content</a></li>
</ul>
</section>

<div id="modx-browser"></div>
<div id="modx-container">
<section id="modx-header" aria-label="Navigation">
Expand Down

0 comments on commit aac69f5

Please sign in to comment.