Skip to content

Commit 482d577

Browse files
Merge pull request #1 from bbcmicrobit/a11y-modal-focus-update
A11y: Table tds not selectable.
2 parents 531d897 + 5756474 commit 482d577

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ <h2><i class="fa fa-cogs"></i> <strong>{{ title }}</strong></h2>
150150
</tr>
151151
{{#snippets}}
152152
<tr id="snippet-{{trigger}}" class="action snippet-selection">
153-
<td role="button">{{trigger}}<span class="snippet-name">{{name}}</span></td>
153+
<td><button class="snippet-button">{{trigger}}</button> <span class="snippet-name">{{name}}</span></td>
154154
<td>{{#describe}}{{name}}{{/describe}}</td>
155155
</tr>
156156
{{/snippets}}

python-main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ function web_editor(config) {
866866
$('.fs-file-list table tbody').append(
867867
'<tr><td>' + name + '</td>' +
868868
'<td>' + (micropythonFs.size(filename)/1024).toFixed(2) + ' Kb</td>' +
869-
'<td><button id="' + pseudoUniqueId + '_remove" class="action save-button remove ' + disabled + '" title='+ loadStrings["remove-but"] +'><i class="fa fa-trash"></i></button>' +
869+
'<td><button id="' + pseudoUniqueId + '_remove" class="action save-button remove ' + disabled + '" title='+ loadStrings["remove-but"] + ' ' + disabled + '><i class="fa fa-trash"></i></button>' +
870870
'<button id="' + pseudoUniqueId + '_save" class="action save-button save" title='+ loadStrings["save-but"] +'><i class="fa fa-download"></i></button></td></tr>'
871871
);
872872
$('#' + pseudoUniqueId + '_save').click(function(e) {
@@ -912,8 +912,8 @@ function web_editor(config) {
912912
function focusModal() {
913913
document.querySelector('body > :not(.vex)').setAttribute('aria-hidden', true);
914914
var dialog = document.querySelector('.vex-content', '.modal-overlay');
915-
var focusableEls = dialog.querySelectorAll('a:not([disabled]), a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled]),td:not([disabled])');
916-
$(focusableEls).each(function(){
915+
var focusableEls = dialog.querySelectorAll('a:not([disabled]), a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled]');
916+
$(focusableEls).each(function() {
917917
$(this).attr('tabindex', '0');
918918
});
919919
focusableEls[0].focus();

static/css/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,21 @@ a.command:hover {
506506
width: 200px;
507507
}
508508

509+
.snippet-button {
510+
text-decoration: none;
511+
background: none;
512+
color: inherit;
513+
border: none;
514+
border-radius: 5px;
515+
padding: 2px;
516+
font: inherit;
517+
cursor: pointer;
518+
outline: inherit;
519+
}
520+
.snippet-button:focus {
521+
box-shadow: 0px 0px 5px 3px #FFCC33;
522+
}
523+
509524
#share-link {
510525
display: none;
511526
}

0 commit comments

Comments
 (0)